├── .eslintrc.js ├── .gitattributes ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── commitlint.config.js ├── elevate └── cr.yml ├── lerna.json ├── logo ├── active.png ├── cml.png ├── qq2-qrcode.jpg └── wx-qr-code.png ├── package-lock.json ├── package.json ├── packages ├── babel-plugin-chameleon-import │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── Plugin.js │ │ └── index.js │ ├── test │ │ └── fixtures │ │ │ ├── array-expression │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── as-arguments-identifier │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── as-arguments │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── binary-expression │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── conditions │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── custom-name │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── custom-style-path-ignore │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── custom-style-path │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── execute-direct │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── execute-member │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── export-import │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── expression-statement │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── file-name │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── import-alias │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── import-css │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── keep-named-import │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── material-ui │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── member-expression │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── modules-false │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── multiple-libraries-hilojs │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── multiple-libraries │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── multiple-words │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── new-expression │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── object-shorthand │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── property │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── react-element │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── react-toolbox │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── return │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── specifier-alias │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── use-multiple-times │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ ├── variable-declarator │ │ │ ├── actual.js │ │ │ └── expected.js │ │ │ └── variable-scope │ │ │ ├── actual.js │ │ │ └── expected.js │ └── yarn.lock ├── chameleon-css-loader │ ├── .eslintrc │ ├── .gitignore │ ├── handler │ │ └── lines.js │ ├── index.js │ ├── package-lock.json │ ├── package.json │ ├── parser │ │ ├── media.js │ │ ├── miniapp.js │ │ ├── web.js │ │ └── weex.js │ ├── postcss │ │ ├── add-alipay-class.js │ │ ├── cpx.js │ │ ├── weex-plus.js │ │ └── weex.js │ ├── proxy │ │ ├── proxyMiniapp.js │ │ └── proxyWeb.js │ ├── test │ │ ├── parser-test │ │ │ ├── media.test.js │ │ │ ├── miniapp.test.js │ │ │ ├── web.test.js │ │ │ └── weex.test.js │ │ ├── postcss-test │ │ │ └── weex-plus.test.js │ │ ├── proxy-test │ │ │ ├── proxyMiniapp.test.js │ │ │ └── proxyWeb.test.js │ │ ├── transform │ │ │ └── weex.test.js │ │ └── utils.test.js │ ├── transform │ │ ├── color.js │ │ └── weex.js │ └── utils.js ├── chameleon-dev-proxy │ ├── .gitignore │ ├── index.js │ ├── package-lock.json │ └── package.json ├── chameleon-errors-webpack-plugin │ ├── .gitignore │ ├── LICENSE │ ├── index.js │ ├── package-lock.json │ ├── package.json │ └── src │ │ ├── core │ │ ├── extractWebpackError.js │ │ ├── formatErrors.js │ │ └── transformErrors.js │ │ ├── formatters │ │ ├── defaultError.js │ │ ├── eslintError.js │ │ └── moduleNotFound.js │ │ ├── friendly-errors-plugin.js │ │ ├── output.js │ │ ├── transformers │ │ ├── babelSyntax.js │ │ ├── esLintError.js │ │ └── moduleNotFound.js │ │ └── utils │ │ ├── colors.js │ │ └── index.js ├── chameleon-linter │ ├── .eslintrc │ ├── .gitignore │ ├── bin │ │ └── cli.js │ ├── checkers │ │ ├── index.js │ │ ├── json.js │ │ ├── script.js │ │ ├── style.js │ │ └── template │ │ │ ├── index.js │ │ │ └── lib │ │ │ ├── js-ast-parser.js │ │ │ ├── json-ast-parser.js │ │ │ └── template-ast-parser │ │ │ ├── classes │ │ │ ├── customized-node.js │ │ │ ├── rule-loader.js │ │ │ └── suspicious-node.js │ │ │ ├── index.js │ │ │ ├── lib │ │ │ ├── ast-tree-traversal.js │ │ │ ├── customized-node-dispatcher.js │ │ │ └── suspicious-node-dispatcher.js │ │ │ ├── options.js │ │ │ ├── rules │ │ │ ├── component │ │ │ │ ├── attr.js │ │ │ │ ├── cml-method-node.js │ │ │ │ ├── cml-prop-node.js │ │ │ │ ├── cml.js │ │ │ │ ├── index.js │ │ │ │ ├── vue-method-node.js │ │ │ │ ├── vue-prop-node.js │ │ │ │ └── vue.js │ │ │ └── template │ │ │ │ ├── cml.js │ │ │ │ ├── index.js │ │ │ │ ├── method-node.js │ │ │ │ ├── mustache-node.js │ │ │ │ ├── vue-directive-node.js │ │ │ │ └── vue.js │ │ │ └── tools │ │ │ ├── dash-to-camelcase.js │ │ │ ├── flat-array.js │ │ │ ├── get-offset-pos-from-text.js │ │ │ ├── get-props-from-object-expression.js │ │ │ ├── index.js │ │ │ ├── is-origin-component.js │ │ │ ├── is-suspicious-textnode.js │ │ │ ├── loop-scope-handler.js │ │ │ ├── parse-single-expression.js │ │ │ └── rule-filter-match.js │ ├── classes │ │ └── message.js │ ├── config │ │ ├── .cmllintrc │ │ ├── built-in-components │ │ │ └── index.js │ │ ├── common-events.json │ │ ├── fakeComps │ │ │ └── index.js │ │ ├── globalVars.js │ │ ├── index.js │ │ ├── parser-config.js │ │ ├── tag-embed-rules.json │ │ └── white-list │ │ │ ├── cml-white-list.js │ │ │ ├── index.js │ │ │ ├── vue-white-list.js │ │ │ ├── web-white-list.js │ │ │ ├── weex-white-list.js │ │ │ └── wx-white-list.js │ ├── docs │ │ ├── cml-file-specification.md │ │ ├── components │ │ │ ├── buildin │ │ │ │ ├── button.md │ │ │ │ ├── checkbox.md │ │ │ │ ├── input.md │ │ │ │ ├── list.md │ │ │ │ ├── page.md │ │ │ │ ├── radio.md │ │ │ │ ├── richtext.md │ │ │ │ ├── scroller.md │ │ │ │ ├── switch.md │ │ │ │ ├── textarea.md │ │ │ │ └── video.md │ │ │ └── chameleon-ui │ │ │ │ ├── c-actionsheet.md │ │ │ │ ├── c-aside.md │ │ │ │ ├── c-checkbox-group.md │ │ │ │ ├── c-col.md │ │ │ │ ├── c-container.md │ │ │ │ ├── c-dialog.md │ │ │ │ ├── c-foot.md │ │ │ │ ├── c-form-item.md │ │ │ │ ├── c-form.md │ │ │ │ ├── c-head.md │ │ │ │ ├── c-main.md │ │ │ │ ├── c-picker-item.md │ │ │ │ ├── c-picker-panel.md │ │ │ │ ├── c-picker.md │ │ │ │ ├── c-popup.md │ │ │ │ ├── c-radio-group.md │ │ │ │ ├── c-refresh.md │ │ │ │ ├── c-row.md │ │ │ │ ├── c-tab-pane-item.md │ │ │ │ ├── c-tab-pane.md │ │ │ │ ├── c-tabs-item.md │ │ │ │ ├── c-tabs.md │ │ │ │ ├── c-tip.md │ │ │ │ └── c-toast.md │ │ ├── directory-specification.md │ │ ├── interface-specification.md │ │ └── templates │ │ │ ├── template-functionalities.md │ │ │ ├── template-internal.md │ │ │ └── template.md │ ├── file-spec.js │ ├── file-structure.js │ ├── index.js │ ├── linters │ │ ├── index.js │ │ ├── json.js │ │ ├── script.js │ │ ├── style.js │ │ └── template.js │ ├── package-lock.json │ ├── package.json │ ├── test │ │ ├── checker │ │ │ └── cml │ │ │ │ ├── json │ │ │ │ ├── nonstandard.cml │ │ │ │ ├── nonstandard.interface │ │ │ │ ├── nonstandard.weex.cml │ │ │ │ ├── nonstandard.wx.cml │ │ │ │ └── standard.cml │ │ │ │ └── script │ │ │ │ ├── global-variable │ │ │ │ ├── standard.interface │ │ │ │ ├── standard.web.cml │ │ │ │ ├── standard.weex.cml │ │ │ │ └── standard.wx.cml │ │ │ │ ├── include │ │ │ │ ├── include-interface-fail.interface │ │ │ │ ├── include-src-cml-fail.interface │ │ │ │ ├── include-src-cml-mis-prop-fail.interface │ │ │ │ ├── include-src-js-class-name-fail.interface │ │ │ │ ├── include-src-js-fail.interface │ │ │ │ ├── include-src-js-mis-prop-fail.interface │ │ │ │ ├── origin-comp-interface.interface │ │ │ │ ├── origin-interface.interface │ │ │ │ └── src │ │ │ │ │ ├── someplatform-mis-class.js │ │ │ │ │ ├── someplatform-mis-prop.cml │ │ │ │ │ └── someplatform-mis-prop.js │ │ │ │ ├── interfaces │ │ │ │ └── prop-not-defined.interface │ │ │ │ ├── no-global-variable │ │ │ │ ├── standard.interface │ │ │ │ ├── standard.web.cml │ │ │ │ ├── standard.weex.cml │ │ │ │ └── standard.wx.cml │ │ │ │ ├── nointerface │ │ │ │ └── nonstandard.wx.cml │ │ │ │ ├── nonstandard.cml │ │ │ │ ├── properties-methods │ │ │ │ ├── event-not-defined.interface │ │ │ │ ├── event-not-defined.web.cml │ │ │ │ ├── property-not-defined.interface │ │ │ │ └── property-not-defined.wx.cml │ │ │ │ ├── standard.cml │ │ │ │ └── standard │ │ │ │ ├── standard.interface │ │ │ │ ├── standard.web.cml │ │ │ │ ├── standard.weex.cml │ │ │ │ └── standard.wx.cml │ │ ├── cml.test.js │ │ ├── config.test.js │ │ ├── core.test.js │ │ ├── core │ │ │ └── standard │ │ │ │ ├── chameleon.config.js │ │ │ │ └── src │ │ │ │ ├── app │ │ │ │ └── app.cml │ │ │ │ ├── router.config.json │ │ │ │ └── store │ │ │ │ └── index.js │ │ ├── interface.test.js │ │ ├── interface │ │ │ └── common.interface │ │ ├── linter │ │ │ └── cml │ │ │ │ ├── cml │ │ │ │ ├── nointerface │ │ │ │ │ └── standard.web.cml │ │ │ │ ├── nonstandard.cml │ │ │ │ ├── standard.cml │ │ │ │ ├── standard │ │ │ │ │ ├── standard.interface │ │ │ │ │ ├── standard.web.cml │ │ │ │ │ ├── standard.weex.cml │ │ │ │ │ └── standard.wx.cml │ │ │ │ └── syntaxError │ │ │ │ │ ├── standard.interface │ │ │ │ │ ├── standard.web.cml │ │ │ │ │ ├── standard.weex.cml │ │ │ │ │ └── standard.wx.cml │ │ │ │ ├── json │ │ │ │ ├── .cmllintrc │ │ │ │ ├── no-bracket.cml │ │ │ │ ├── no-comma.cml │ │ │ │ ├── no-quotes.cml │ │ │ │ └── standard.cml │ │ │ │ ├── script │ │ │ │ ├── nonstandard-arrow.cml │ │ │ │ ├── nonstandard.cml │ │ │ │ └── standard.cml │ │ │ │ └── style │ │ │ │ ├── .cmllintrc │ │ │ │ ├── nest.cml │ │ │ │ ├── no-bracket.cml │ │ │ │ ├── no-semicolon.cml │ │ │ │ ├── no-standard-important.cml │ │ │ │ ├── no-standard.stylus.cml │ │ │ │ ├── standard.cml │ │ │ │ └── standard.stylus.cml │ │ ├── lintrc │ │ │ ├── nonstandard │ │ │ │ └── .cmllintrc │ │ │ └── standard │ │ │ │ └── .cmllintrc │ │ ├── template │ │ │ ├── checker │ │ │ │ ├── template-lib-class.test.js │ │ │ │ ├── template-lib-export.test.js │ │ │ │ ├── template-lib-js.test.js │ │ │ │ ├── template-lib-json.test.js │ │ │ │ ├── template-lib-template.test.js │ │ │ │ └── template.test.js │ │ │ ├── docs │ │ │ │ ├── check │ │ │ │ │ ├── fail │ │ │ │ │ │ ├── index-props-events-cml.cml │ │ │ │ │ │ ├── index-props-events-vue.cml │ │ │ │ │ │ ├── index-props-methods-polymorphic.cml │ │ │ │ │ │ ├── index-props-methods-single.cml │ │ │ │ │ │ ├── index-vars-events.cml │ │ │ │ │ │ ├── index-vars-methods-cml.cml │ │ │ │ │ │ └── index-vars-methods-vue.cml │ │ │ │ │ └── success │ │ │ │ │ │ ├── index-lib-check-class.cml │ │ │ │ │ │ ├── index-lib-check-export.cml │ │ │ │ │ │ ├── index-lib-check-implements.cml │ │ │ │ │ │ ├── index-lib-check-plugin.cml │ │ │ │ │ │ ├── index-lib-check-vue-class.cml │ │ │ │ │ │ ├── index-lib-js-class.cml │ │ │ │ │ │ ├── index-lib-js-export.cml │ │ │ │ │ │ ├── index-lib-json-polymorphic.cml │ │ │ │ │ │ ├── index-lib-json-single.cml │ │ │ │ │ │ ├── index-lib-template-cml.cml │ │ │ │ │ │ └── index-lib-template-vue.cml │ │ │ │ ├── components │ │ │ │ │ ├── c-checkbox │ │ │ │ │ │ ├── c-checkbox.cml │ │ │ │ │ │ └── images │ │ │ │ │ │ │ ├── selected.png │ │ │ │ │ │ │ └── unselected.png │ │ │ │ │ ├── radio │ │ │ │ │ │ └── radio.cml │ │ │ │ │ ├── scroller │ │ │ │ │ │ ├── scroller.interface │ │ │ │ │ │ ├── scroller.web.cml │ │ │ │ │ │ ├── scroller.weex.cml │ │ │ │ │ │ └── scroller.wx.cml │ │ │ │ │ ├── show-component │ │ │ │ │ │ ├── scroller.interface │ │ │ │ │ │ ├── scroller.web.cml │ │ │ │ │ │ ├── scroller.weex.cml │ │ │ │ │ │ └── scroller.wx.cml │ │ │ │ │ └── single │ │ │ │ │ │ └── single.cml │ │ │ │ └── node_modules │ │ │ │ │ ├── .DS_Store │ │ │ │ │ ├── @didi │ │ │ │ │ ├── .DS_Store │ │ │ │ │ └── chameleon-ui-builtin │ │ │ │ │ │ ├── .DS_Store │ │ │ │ │ │ └── components │ │ │ │ │ │ ├── .DS_Store │ │ │ │ │ │ ├── button │ │ │ │ │ │ ├── button.interface │ │ │ │ │ │ ├── button.web.cml │ │ │ │ │ │ ├── button.weex.cml │ │ │ │ │ │ ├── button.wx.cml │ │ │ │ │ │ └── type.js │ │ │ │ │ │ └── radio │ │ │ │ │ │ └── radio.cml │ │ │ │ │ └── chameleon-ui-builtin │ │ │ │ │ ├── .DS_Store │ │ │ │ │ └── components │ │ │ │ │ ├── .DS_Store │ │ │ │ │ ├── button │ │ │ │ │ ├── button.interface │ │ │ │ │ ├── button.web.cml │ │ │ │ │ ├── button.weex.cml │ │ │ │ │ ├── button.wx.cml │ │ │ │ │ └── type.js │ │ │ │ │ └── radio │ │ │ │ │ └── radio.cml │ │ │ └── linter │ │ │ │ ├── cases │ │ │ │ ├── fail │ │ │ │ │ ├── built-in-embed-rule-excludes-error.js │ │ │ │ │ ├── built-in-embed-rule-includes-error.js │ │ │ │ │ ├── built-in-props-error.js │ │ │ │ │ ├── built-in-props-lang-vue-error.js │ │ │ │ │ ├── directive-cml-error.js │ │ │ │ │ ├── directive-vue-error.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── lang-error.js │ │ │ │ │ ├── origin-component-cml-directive-forbiden-error.js │ │ │ │ │ ├── origin-component-skip-rules-error.js │ │ │ │ │ ├── platform-specific-tags-error.js │ │ │ │ │ ├── template-tag-error.js │ │ │ │ │ └── usingcomponent-ref-error.js │ │ │ │ └── pass │ │ │ │ │ ├── built-in-embed-rule-excludes-pass.js │ │ │ │ │ ├── built-in-embed-rule-includes-pass.js │ │ │ │ │ ├── built-in-props-lang-vue-pass.js │ │ │ │ │ ├── built-in-props-pass.js │ │ │ │ │ ├── component-is-pass.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── lang-pass.js │ │ │ │ │ ├── origin-component-skip-rules-pass.js │ │ │ │ │ ├── platform-specific-tags-pass.js │ │ │ │ │ ├── tag-close.js │ │ │ │ │ └── usingcomponent-ref-pass.js │ │ │ │ └── template.test.js │ │ └── utils.test.js │ └── utils.js ├── chameleon-loader │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── .scripts │ │ └── version.js │ ├── LICENSE │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── cml-compile │ │ │ ├── handle-platform-css.js │ │ │ ├── json-handle.js │ │ │ ├── runtime │ │ │ │ ├── app.js │ │ │ │ ├── common │ │ │ │ │ └── util.js │ │ │ │ ├── component.js │ │ │ │ ├── index.js │ │ │ │ ├── page.js │ │ │ │ ├── web │ │ │ │ │ ├── app.js │ │ │ │ │ ├── component.js │ │ │ │ │ ├── page.js │ │ │ │ │ └── util.js │ │ │ │ ├── weex │ │ │ │ │ └── util.js │ │ │ │ └── wx │ │ │ │ │ └── util.js │ │ │ └── wxml-selector.js │ │ ├── helpers.js │ │ ├── index.js │ │ ├── interface-check │ │ │ ├── check.js │ │ │ └── getScriptCode.js │ │ ├── load-icon.js │ │ ├── loader.js │ │ ├── loaderMethods.js │ │ ├── miniapp-script.js │ │ ├── parser.js │ │ ├── runtime │ │ │ ├── check.js │ │ │ └── component-normalizer.js │ │ ├── selector.js │ │ └── utils │ │ │ ├── normalize.js │ │ │ ├── prehandle.js │ │ │ └── try-require.js │ └── test │ │ └── src │ │ ├── cml-compile.test │ │ └── runtime │ │ │ ├── all-properties.js │ │ │ ├── common-utils.test.js │ │ │ ├── web-utils.test.js │ │ │ ├── weex-utils.test.js │ │ │ └── wx-utils.test.js │ │ ├── load-icon.test.js │ │ ├── loader.test.js │ │ ├── loaderMethods.test.js │ │ ├── parser.cml │ │ ├── parser.test.js │ │ ├── project │ │ ├── node_modules │ │ │ └── cml-ui │ │ │ │ └── scroller │ │ │ │ └── scroller.cml │ │ └── src │ │ │ ├── components │ │ │ └── coma.cml │ │ │ └── pages │ │ │ └── pagea.cml │ │ └── utils.test │ │ ├── normalize.test.js │ │ ├── prehandle.test.js │ │ └── try-require.test.js ├── chameleon-miniapp-target │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ └── src │ │ ├── JsonpChunkTemplatePlugin.js │ │ ├── JsonpHotUpdateChunkTemplatePlugin.js │ │ ├── JsonpMainTemplatePlugin.js │ │ ├── JsonpTemplatePlugin.js │ │ └── index.js ├── chameleon-mixins │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── alipay-mixins.js │ ├── common.js │ ├── miniapp-utils │ │ └── px2cpx.js │ ├── package-lock.json │ ├── package.json │ ├── test │ │ ├── common.test.js │ │ ├── utils.test.js │ │ ├── web-mixins.test.js │ │ ├── weex-mixins.test.js │ │ └── wx-mixins.test.js │ ├── utils.js │ ├── web-mixins.js │ ├── web-utils │ │ └── px2cpx.js │ ├── weex-mixins.js │ ├── wx-alipay-common-mixins.js │ └── wx-mixins.js ├── chameleon-template-parse │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── LICENSE │ ├── gulpfile.js │ ├── index.html │ ├── index.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── common │ │ │ ├── cml-map.js │ │ │ ├── process-template.js │ │ │ └── utils.js │ │ ├── compile-template-cml.js │ │ ├── compile-template-vue.js │ │ ├── index.js │ │ └── parser │ │ │ ├── index.js │ │ │ ├── parse-animation-tag.js │ │ │ ├── parse-attribute.js │ │ │ ├── parse-class.js │ │ │ ├── parse-condition.js │ │ │ ├── parse-directive.js │ │ │ ├── parse-event.js │ │ │ ├── parse-interation.js │ │ │ ├── parse-ref.js │ │ │ ├── parse-style.js │ │ │ └── parse-vue2wx.js │ ├── test │ │ ├── common │ │ │ ├── process-template.test.js │ │ │ └── utils.test.js │ │ ├── index.js │ │ └── parser │ │ │ ├── cml.test.js │ │ │ ├── index.cml.test.js │ │ │ ├── index.vue.test.js │ │ │ └── vue.test.js │ └── webpack.config.js ├── chameleon-templates │ ├── .eslintrc │ ├── .gitignore │ ├── component │ │ ├── component │ │ │ └── index.cml │ │ ├── interface-component │ │ │ ├── index.alipay.cml │ │ │ ├── index.baidu.cml │ │ │ ├── index.interface │ │ │ ├── index.qq.cml │ │ │ ├── index.tt.cml │ │ │ ├── index.web.cml │ │ │ ├── index.weex.cml │ │ │ └── index.wx.cml │ │ └── interface-js │ │ │ └── index.interface │ ├── index.js │ ├── package.json │ ├── page │ │ └── index.cml │ ├── project │ │ ├── .gitignore │ │ ├── chameleon.config.js │ │ ├── mock │ │ │ ├── api │ │ │ │ └── index.js │ │ │ └── template │ │ │ │ └── index.php │ │ ├── package.json │ │ └── src │ │ │ ├── app │ │ │ └── app.cml │ │ │ ├── assets │ │ │ └── images │ │ │ │ └── chameleon.png │ │ │ ├── components │ │ │ └── demo-com │ │ │ │ └── demo-com.cml │ │ │ ├── pages │ │ │ └── index │ │ │ │ └── index.cml │ │ │ ├── router.config.json │ │ │ └── store │ │ │ ├── actions.js │ │ │ ├── getters.js │ │ │ ├── index.js │ │ │ ├── mutations.js │ │ │ └── state.js │ ├── server │ │ ├── fisdata │ │ │ ├── FISData.class.php │ │ │ ├── Manager.class.php │ │ │ ├── README.md │ │ │ ├── TestData.class.php │ │ │ ├── bookmark.js │ │ │ ├── index.tpl │ │ │ ├── libs │ │ │ │ ├── JsonPro │ │ │ │ │ ├── CommonHelper.php │ │ │ │ │ ├── Demo.php │ │ │ │ │ ├── adocParser.php │ │ │ │ │ ├── genArray.php │ │ │ │ │ ├── genCase.php │ │ │ │ │ ├── genConf.php │ │ │ │ │ ├── genFile.php │ │ │ │ │ ├── genInterface.php │ │ │ │ │ ├── genLog.php │ │ │ │ │ └── genValue.php │ │ │ │ └── Util.class.php │ │ │ ├── package.json │ │ │ └── plugin │ │ │ │ ├── ChameleonData.class.php │ │ │ │ ├── FISADOCData.class.php │ │ │ │ ├── FISJSONData.class.php │ │ │ │ ├── FISPHPData.class.php │ │ │ │ ├── gen_plugins.php.sh │ │ │ │ └── plugins.php │ │ ├── index.php │ │ ├── rewrite │ │ │ ├── README.md │ │ │ └── Rewrite.php │ │ ├── smarty.conf │ │ └── smarty │ │ │ ├── Smarty.class.php │ │ │ ├── SmartyBC.class.php │ │ │ ├── debug.tpl │ │ │ ├── plugins │ │ │ ├── block.textformat.php │ │ │ ├── function.counter.php │ │ │ ├── function.cycle.php │ │ │ ├── function.fetch.php │ │ │ ├── function.html_checkboxes.php │ │ │ ├── function.html_image.php │ │ │ ├── function.html_options.php │ │ │ ├── function.html_radios.php │ │ │ ├── function.html_select_date.php │ │ │ ├── function.html_select_time.php │ │ │ ├── function.html_table.php │ │ │ ├── function.mailto.php │ │ │ ├── function.math.php │ │ │ ├── modifier.capitalize.php │ │ │ ├── modifier.date_format.php │ │ │ ├── modifier.debug_print_var.php │ │ │ ├── modifier.escape.php │ │ │ ├── modifier.regex_replace.php │ │ │ ├── modifier.replace.php │ │ │ ├── modifier.spacify.php │ │ │ ├── modifier.truncate.php │ │ │ ├── modifiercompiler.cat.php │ │ │ ├── modifiercompiler.count_characters.php │ │ │ ├── modifiercompiler.count_paragraphs.php │ │ │ ├── modifiercompiler.count_sentences.php │ │ │ ├── modifiercompiler.count_words.php │ │ │ ├── modifiercompiler.default.php │ │ │ ├── modifiercompiler.escape.php │ │ │ ├── modifiercompiler.from_charset.php │ │ │ ├── modifiercompiler.indent.php │ │ │ ├── modifiercompiler.lower.php │ │ │ ├── modifiercompiler.noprint.php │ │ │ ├── modifiercompiler.string_format.php │ │ │ ├── modifiercompiler.strip.php │ │ │ ├── modifiercompiler.strip_tags.php │ │ │ ├── modifiercompiler.to_charset.php │ │ │ ├── modifiercompiler.unescape.php │ │ │ ├── modifiercompiler.upper.php │ │ │ ├── modifiercompiler.wordwrap.php │ │ │ ├── outputfilter.trimwhitespace.php │ │ │ ├── shared.escape_special_chars.php │ │ │ ├── shared.literal_compiler_param.php │ │ │ ├── shared.make_timestamp.php │ │ │ ├── shared.mb_str_replace.php │ │ │ ├── shared.mb_unicode.php │ │ │ ├── shared.mb_wordwrap.php │ │ │ └── variablefilter.htmlspecialchars.php │ │ │ └── sysplugins │ │ │ ├── smarty_cacheresource.php │ │ │ ├── smarty_cacheresource_custom.php │ │ │ ├── smarty_cacheresource_keyvaluestore.php │ │ │ ├── smarty_config_source.php │ │ │ ├── smarty_internal_cacheresource_file.php │ │ │ ├── smarty_internal_compile_append.php │ │ │ ├── smarty_internal_compile_assign.php │ │ │ ├── smarty_internal_compile_block.php │ │ │ ├── smarty_internal_compile_break.php │ │ │ ├── smarty_internal_compile_call.php │ │ │ ├── smarty_internal_compile_capture.php │ │ │ ├── smarty_internal_compile_config_load.php │ │ │ ├── smarty_internal_compile_continue.php │ │ │ ├── smarty_internal_compile_debug.php │ │ │ ├── smarty_internal_compile_eval.php │ │ │ ├── smarty_internal_compile_extends.php │ │ │ ├── smarty_internal_compile_for.php │ │ │ ├── smarty_internal_compile_foreach.php │ │ │ ├── smarty_internal_compile_function.php │ │ │ ├── smarty_internal_compile_if.php │ │ │ ├── smarty_internal_compile_include.php │ │ │ ├── smarty_internal_compile_include_php.php │ │ │ ├── smarty_internal_compile_insert.php │ │ │ ├── smarty_internal_compile_ldelim.php │ │ │ ├── smarty_internal_compile_nocache.php │ │ │ ├── smarty_internal_compile_private_block_plugin.php │ │ │ ├── smarty_internal_compile_private_function_plugin.php │ │ │ ├── smarty_internal_compile_private_modifier.php │ │ │ ├── smarty_internal_compile_private_object_block_function.php │ │ │ ├── smarty_internal_compile_private_object_function.php │ │ │ ├── smarty_internal_compile_private_print_expression.php │ │ │ ├── smarty_internal_compile_private_registered_block.php │ │ │ ├── smarty_internal_compile_private_registered_function.php │ │ │ ├── smarty_internal_compile_private_special_variable.php │ │ │ ├── smarty_internal_compile_rdelim.php │ │ │ ├── smarty_internal_compile_section.php │ │ │ ├── smarty_internal_compile_setfilter.php │ │ │ ├── smarty_internal_compile_while.php │ │ │ ├── smarty_internal_compilebase.php │ │ │ ├── smarty_internal_config.php │ │ │ ├── smarty_internal_config_file_compiler.php │ │ │ ├── smarty_internal_configfilelexer.php │ │ │ ├── smarty_internal_configfileparser.php │ │ │ ├── smarty_internal_data.php │ │ │ ├── smarty_internal_debug.php │ │ │ ├── smarty_internal_filter_handler.php │ │ │ ├── smarty_internal_function_call_handler.php │ │ │ ├── smarty_internal_get_include_path.php │ │ │ ├── smarty_internal_nocache_insert.php │ │ │ ├── smarty_internal_parsetree.php │ │ │ ├── smarty_internal_resource_eval.php │ │ │ ├── smarty_internal_resource_extends.php │ │ │ ├── smarty_internal_resource_file.php │ │ │ ├── smarty_internal_resource_php.php │ │ │ ├── smarty_internal_resource_registered.php │ │ │ ├── smarty_internal_resource_stream.php │ │ │ ├── smarty_internal_resource_string.php │ │ │ ├── smarty_internal_smartytemplatecompiler.php │ │ │ ├── smarty_internal_template.php │ │ │ ├── smarty_internal_templatebase.php │ │ │ ├── smarty_internal_templatecompilerbase.php │ │ │ ├── smarty_internal_templatelexer.php │ │ │ ├── smarty_internal_templateparser.php │ │ │ ├── smarty_internal_utility.php │ │ │ ├── smarty_internal_write_file.php │ │ │ ├── smarty_resource.php │ │ │ ├── smarty_resource_custom.php │ │ │ ├── smarty_resource_recompiled.php │ │ │ ├── smarty_resource_uncompiled.php │ │ │ └── smarty_security.php │ └── todo-demo │ │ ├── .gitignore │ │ ├── chameleon.config.js │ │ ├── mock │ │ ├── api │ │ │ └── index.js │ │ └── template │ │ │ └── index.php │ │ ├── package.json │ │ └── src │ │ ├── app │ │ └── app.cml │ │ ├── assets │ │ └── images │ │ │ ├── chameleon.png │ │ │ └── close.png │ │ ├── components │ │ ├── c-checkbox │ │ │ └── c-checkbox.cml │ │ └── c-todoitem │ │ │ └── c-todoitem.cml │ │ ├── pages │ │ └── index │ │ │ └── index.cml │ │ ├── router.config.json │ │ └── store │ │ ├── action-types.js │ │ ├── actions.js │ │ ├── getter-types.js │ │ ├── getters.js │ │ ├── index.js │ │ ├── index │ │ ├── action-types.js │ │ ├── actions.js │ │ ├── getter-types.js │ │ ├── getters.js │ │ ├── mutation-types.js │ │ ├── mutations.js │ │ └── state.js │ │ ├── mutation-types.js │ │ ├── mutations.js │ │ ├── state.js │ │ └── utils.js ├── chameleon-tool-utils │ ├── .eslintrc │ ├── .gitignore │ ├── .istanbul.yml │ ├── .npmignore │ ├── .travis.yml │ ├── gulpfile.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.js │ │ ├── lib │ │ │ └── splitParts.js │ │ └── log.js │ └── test │ │ ├── index.test.js │ │ ├── log.test.js │ │ └── testlib │ │ ├── alipay │ │ ├── alipay.axml │ │ └── alipay.json │ │ ├── baidu │ │ ├── baidu.json │ │ └── baidu.swan │ │ ├── cli │ │ └── config.js │ │ ├── demo-project │ │ ├── .gitignore │ │ ├── chameleon.config.js │ │ ├── coma │ │ │ └── coma.interface │ │ ├── comb │ │ │ └── comb.cml │ │ ├── index.cml │ │ ├── node_modules │ │ │ ├── chameleon-ui-builtin │ │ │ │ ├── components │ │ │ │ │ ├── button │ │ │ │ │ │ ├── button.cml │ │ │ │ │ │ └── button.interface │ │ │ │ │ └── com1 │ │ │ │ │ │ └── com1.cml │ │ │ │ └── package.json │ │ │ ├── cml-pages │ │ │ │ ├── package.json │ │ │ │ └── src │ │ │ │ │ └── router.config.json │ │ │ ├── cml-subproject │ │ │ │ ├── .gitignore │ │ │ │ ├── chameleon.config.js │ │ │ │ ├── mock │ │ │ │ │ ├── api │ │ │ │ │ │ └── index.js │ │ │ │ │ └── template │ │ │ │ │ │ └── index.php │ │ │ │ ├── npm-shrinkwrap.json │ │ │ │ ├── package.json │ │ │ │ └── src │ │ │ │ │ ├── app │ │ │ │ │ └── app.cml │ │ │ │ │ ├── assets │ │ │ │ │ └── images │ │ │ │ │ │ └── chameleon.png │ │ │ │ │ ├── components │ │ │ │ │ └── demo-com │ │ │ │ │ │ └── demo-com.cml │ │ │ │ │ ├── pages │ │ │ │ │ └── index │ │ │ │ │ │ └── index.cml │ │ │ │ │ ├── router.config.json │ │ │ │ │ └── store │ │ │ │ │ ├── actions.js │ │ │ │ │ ├── getters.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── mutations.js │ │ │ │ │ └── state.js │ │ │ ├── copy-npm │ │ │ │ └── package.json │ │ │ ├── npm-components │ │ │ │ ├── components │ │ │ │ │ ├── button │ │ │ │ │ │ ├── button.cml │ │ │ │ │ │ └── button.interface │ │ │ │ │ └── com1 │ │ │ │ │ │ └── com1.cml │ │ │ │ └── package.json │ │ │ └── vant-weapp │ │ │ │ ├── test.js │ │ │ │ ├── test.json │ │ │ │ ├── test.wxml │ │ │ │ └── test.wxss │ │ ├── package.json │ │ └── src │ │ │ ├── app │ │ │ └── app.cml │ │ │ ├── components │ │ │ ├── com1 │ │ │ │ └── com1.cml │ │ │ ├── com2 │ │ │ │ ├── com2.interface │ │ │ │ ├── com2.web.cml │ │ │ │ └── com2.wx.cml │ │ │ └── com3 │ │ │ │ └── com3.interface │ │ │ ├── pages │ │ │ ├── pagea │ │ │ │ └── pagea.cml │ │ │ └── pageb │ │ │ │ └── pageb.cml │ │ │ └── router.config.json │ │ ├── index.cml │ │ ├── index.interface │ │ └── wx │ │ ├── wx.json │ │ └── wx.wxml ├── chameleon-tool │ ├── .babelrc │ ├── .eslintrc │ ├── .gitignore │ ├── .istanbul.yml │ ├── .npmignore │ ├── .travis.yml │ ├── README.md │ ├── chameleon.js │ ├── commanders │ │ ├── alipay │ │ │ └── index.js │ │ ├── baidu │ │ │ └── index.js │ │ ├── build │ │ │ └── index.js │ │ ├── dev │ │ │ └── index.js │ │ ├── ext │ │ │ └── index.js │ │ ├── extPlatform.js │ │ ├── info │ │ │ └── index.js │ │ ├── init │ │ │ ├── index.js │ │ │ └── platform.json │ │ ├── qq │ │ │ └── index.js │ │ ├── server │ │ │ └── index.js │ │ ├── tt │ │ │ └── index.js │ │ ├── utils.js │ │ ├── web │ │ │ ├── apiMiddleware.js │ │ │ ├── dev-client.js │ │ │ ├── dev-server.js │ │ │ ├── dynamicApiMiddleware.js │ │ │ ├── index.js │ │ │ ├── liveload-dev-client.js │ │ │ ├── php_cgi_middleware.js │ │ │ ├── responseTime.js │ │ │ └── web-socket.js │ │ ├── weex │ │ │ ├── index.js │ │ │ └── socket-server.js │ │ └── wx │ │ │ └── index.js │ ├── configs │ │ ├── cml-loader.conf.js │ │ ├── component_export │ │ │ ├── dependencies.js │ │ │ ├── export-loader.js │ │ │ ├── exportPlugin.js │ │ │ ├── getMiniAppExportConfig.js │ │ │ ├── getWebExportConfig.js │ │ │ ├── getWebExportConfig_new.js │ │ │ ├── getWeexExportConfig.js │ │ │ ├── getWeexExportConfig_new.js │ │ │ ├── postcssPlugin.js │ │ │ ├── utils.js │ │ │ ├── webpack.web.config.js │ │ │ └── webpack.weex.config.js │ │ ├── config.js │ │ ├── default │ │ │ ├── app.cml │ │ │ ├── entry.js │ │ │ ├── html_entry.html │ │ │ ├── miniappPolyfill.js │ │ │ ├── rem.js │ │ │ ├── router.js │ │ │ ├── smarty_entry.html │ │ │ ├── weexPolyfill.js │ │ │ └── weex_liveload_entry.js │ │ ├── entryLoader.js │ │ ├── getCommonConfig.js │ │ ├── getMiniAppBuildConfig.js │ │ ├── getMiniAppCommonConfig.js │ │ ├── getMiniAppDevConfig.js │ │ ├── getWebBuildConfig.js │ │ ├── getWebCommonConfig.js │ │ ├── getWebDevConfig.js │ │ ├── getWebExportConfig.js │ │ ├── getWeexBuildConfig.js │ │ ├── getWeexCommonConfig.js │ │ ├── getWeexDevConfig.js │ │ ├── index.js │ │ ├── mvvm │ │ │ ├── getExtendConfig.js │ │ │ └── originSourceLoader.js │ │ ├── plugins │ │ │ ├── CopyNpmPLugin.js │ │ │ ├── miniAppBaseCssAdd.js │ │ │ └── miniAppSubPkg.js │ │ ├── postcss │ │ │ ├── alipay │ │ │ │ └── .postcssrc.js │ │ │ ├── baidu │ │ │ │ └── .postcssrc.js │ │ │ ├── export │ │ │ │ └── .postcssrc.js │ │ │ ├── extend │ │ │ │ └── .postcssrc.js │ │ │ ├── qq │ │ │ │ └── .postcssrc.js │ │ │ ├── tt │ │ │ │ └── .postcssrc.js │ │ │ ├── web │ │ │ │ └── .postcssrc.js │ │ │ ├── weex │ │ │ │ └── .postcssrc.js │ │ │ └── wx │ │ │ │ └── .postcssrc.js │ │ ├── preview-assets │ │ │ ├── cml-alipay.png │ │ │ ├── cml-baidu.png │ │ │ ├── cml-chameleon.png │ │ │ ├── cml-forbidden.png │ │ │ ├── cml-h5.png │ │ │ ├── cml-logo.png │ │ │ ├── cml-qq.png │ │ │ ├── cml-right.png │ │ │ ├── cml-tt.png │ │ │ ├── cml-weex.png │ │ │ ├── cml-weixin.png │ │ │ ├── didiConsole-1.0.7.min.js │ │ │ ├── phone.png │ │ │ └── qrcode.js │ │ ├── preview.html │ │ ├── routerLoader.js │ │ ├── utils.js │ │ ├── web_empty.html │ │ ├── web_global.css │ │ ├── web_global.js │ │ └── weex_liveload │ │ │ ├── WeexWebSocket.js │ │ │ └── liveLoad.js │ ├── lib │ │ ├── cli.js │ │ ├── config.js │ │ ├── index.js │ │ ├── log.js │ │ └── utils.js │ ├── npm-shrinkwrap.json │ ├── package-lock.json │ ├── package.json │ └── test │ │ ├── commander │ │ ├── index.cml │ │ ├── index.interface │ │ └── init.test.js │ │ ├── configs │ │ └── utils.js │ │ └── lib │ │ ├── cli.test.js │ │ ├── config.test.js │ │ ├── index.test.js │ │ └── log.test.js ├── chameleon-vue-precompiler │ ├── .gitignore │ ├── .npmignore │ ├── lib │ │ ├── index.js │ │ └── precompiler │ │ │ ├── components │ │ │ ├── div.js │ │ │ ├── index.js │ │ │ └── span.js │ │ │ ├── config.js │ │ │ ├── hooks │ │ │ ├── events.js │ │ │ ├── index.js │ │ │ ├── style-binding.js │ │ │ └── style.js │ │ │ ├── index.js │ │ │ ├── node │ │ │ └── tag.js │ │ │ └── util │ │ │ ├── ast.js │ │ │ └── index.js │ ├── package-lock.json │ └── package.json ├── chameleon-webpack-plugin │ ├── .eslintrc │ ├── .gitignore │ ├── index.js │ ├── lib │ │ ├── chunkhash.js │ │ ├── moduleId.js │ │ └── utils.js │ ├── package-lock.json │ ├── package.json │ └── test │ │ └── utils.test.js ├── chameleon-weex-vue-loader │ ├── .gitignore │ ├── index.js │ ├── lib │ │ ├── gen-id.js │ │ ├── loader.js │ │ ├── normalize.js │ │ ├── parser.js │ │ ├── script-loader.js │ │ ├── selector.js │ │ ├── style-loader.js │ │ ├── style-rewriter.js │ │ ├── template-compiler.js │ │ └── template-loader.js │ ├── package-lock.json │ └── package.json ├── cml-component-parser │ ├── .eslintrc │ ├── .gitignore │ ├── bin │ │ └── cli.js │ ├── config │ │ └── parse-config.js │ ├── index.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── entrance-flat.js │ │ └── readme-builder.js │ └── test │ │ ├── docs │ │ ├── built-in-components │ │ │ ├── input │ │ │ │ ├── input.interface │ │ │ │ ├── input.web.cml │ │ │ │ ├── input.weex.cml │ │ │ │ └── input.wx.cml │ │ │ └── layout │ │ │ │ ├── aside │ │ │ │ └── aside.cml │ │ │ │ ├── col │ │ │ │ └── col.cml │ │ │ │ ├── container │ │ │ │ └── container.cml │ │ │ │ └── foot │ │ │ │ └── foot.cml │ │ ├── export-default.cml │ │ └── index.interface │ │ └── test.js ├── cml-extract-css-webpack-plugin │ ├── LICENSE │ ├── README.md │ ├── dist │ │ ├── cjs.js │ │ ├── helper.js │ │ ├── index.js │ │ ├── lib │ │ │ ├── ExtractTextPluginCompilation.js │ │ │ ├── ExtractedModule.js │ │ │ ├── OrderUndefinedError.js │ │ │ └── helpers.js │ │ └── loader.js │ ├── package-lock.json │ ├── package.json │ ├── schema │ │ ├── loader.json │ │ └── plugin.json │ └── test │ │ └── index.js ├── cml-htmllinter │ ├── AUTHORS │ ├── HISTORY │ ├── LICENSE │ ├── docs │ │ └── gen_options.js │ ├── gulpfile.js │ ├── lib │ │ ├── config.js │ │ ├── hook │ │ │ ├── index.js │ │ │ ├── skip-empty-text.js │ │ │ ├── skip-normal-tag.js │ │ │ └── skip_origin_tag.js │ │ ├── index.js │ │ ├── inline_config.js │ │ ├── issue.js │ │ ├── knife │ │ │ ├── README.md │ │ │ ├── apply_rules.js │ │ │ ├── attr_parse.js │ │ │ ├── boolean_attrs.js │ │ │ ├── index.js │ │ │ ├── is_cml_directives.js │ │ │ ├── is_common_attrs.js │ │ │ ├── is_common_events.js │ │ │ ├── is_labeable.js │ │ │ ├── is_origin_tag.js │ │ │ ├── is_void_element.js │ │ │ ├── lang_tag.js │ │ │ ├── match_filter.js │ │ │ ├── relative_line_col.js │ │ │ ├── shred.js │ │ │ └── tag_utils.js │ │ ├── linter.js │ │ ├── messages.js │ │ ├── parser │ │ │ ├── dom_builder.js │ │ │ └── index.js │ │ ├── presets │ │ │ ├── accessibility.js │ │ │ ├── default.js │ │ │ ├── global.js │ │ │ ├── index.js │ │ │ └── validate.js │ │ ├── process_option.js │ │ ├── rules │ │ │ ├── attr-bans.js │ │ │ ├── attr-name-style.js │ │ │ ├── attr-new-line.js │ │ │ ├── attr-no-dup.js │ │ │ ├── attr-no-unsafe-char.js │ │ │ ├── attr-order.js │ │ │ ├── attr-quote-style.js │ │ │ ├── attr-req-value.js │ │ │ ├── attr-validate.js │ │ │ ├── attr.js │ │ │ ├── class-no-dup.js │ │ │ ├── class-style.js │ │ │ ├── class.js │ │ │ ├── component-attr-check.js │ │ │ ├── directive-cml-valid-value.js │ │ │ ├── directive-cml.js │ │ │ ├── directive-name-forbiden.js │ │ │ ├── doctype-first.js │ │ │ ├── doctype-html5.js │ │ │ ├── dom.js │ │ │ ├── fig-req-figcaption.js │ │ │ ├── focusable-tabindex-style.js │ │ │ ├── free-options.js │ │ │ ├── head-req-title.js │ │ │ ├── head-valid-content-model.js │ │ │ ├── href-style.js │ │ │ ├── html-valid-content-model.js │ │ │ ├── id-class-no-ad.js │ │ │ ├── id-no-dup.js │ │ │ ├── id-style.js │ │ │ ├── img-req-alt.js │ │ │ ├── img-req-src.js │ │ │ ├── indent-style.js │ │ │ ├── index.js │ │ │ ├── input-radio-req-name.js │ │ │ ├── input-req-label.js │ │ │ ├── label-req-for.js │ │ │ ├── lang.js │ │ │ ├── line-end-style.js │ │ │ ├── line-max-len.js │ │ │ ├── line-no-trailing-whitespace.js │ │ │ ├── line.js │ │ │ ├── link-req-noopener.js │ │ │ ├── origin-tag-forbidden-directive.js │ │ │ ├── origin-tag.js │ │ │ ├── spec-char-escape.js │ │ │ ├── table-req-caption.js │ │ │ ├── table-req-header.js │ │ │ ├── tag-bans.js │ │ │ ├── tag-close.js │ │ │ ├── tag-embed.js │ │ │ ├── tag-name-lowercase.js │ │ │ ├── tag-req-attr.js │ │ │ ├── tag-white-list.js │ │ │ ├── tag.js │ │ │ ├── template-lang.js │ │ │ ├── text-forbid-raw.js │ │ │ ├── text.js │ │ │ ├── title-max-len.js │ │ │ ├── title-no-dup.js │ │ │ └── title.js │ │ └── tools │ │ │ ├── index.js │ │ │ └── is_origin_component.js │ ├── package-lock.json │ ├── package.json │ ├── repl.js │ └── test │ │ ├── .eslintrc │ │ ├── fixtures │ │ ├── .gitkeep │ │ ├── const_rule.js │ │ └── sanity.html │ │ ├── functional │ │ ├── attr-bans.js │ │ ├── attr-name-style.js │ │ ├── attr-new-line.js │ │ ├── attr-no-dup.js │ │ ├── attr-no-unsafe-char.js │ │ ├── attr-order.js │ │ ├── attr-quote-style.js │ │ ├── attr-req-value.js │ │ ├── attr-validate.js │ │ ├── class-no-dup.js │ │ ├── class-style.js │ │ ├── component-attr-check.js │ │ ├── doctype-first.js │ │ ├── doctype-html5.js │ │ ├── fig-req-figcaption.js │ │ ├── focusable-tabindex-style.js │ │ ├── head-req-title.js │ │ ├── head-valid-content-model.js │ │ ├── href-style.js │ │ ├── html-valid-content-model.js │ │ ├── id-class-no-ad.js │ │ ├── id-no-dup.js │ │ ├── id-style.js │ │ ├── img-req-alt.js │ │ ├── img-req-src.js │ │ ├── indent-delta.js │ │ ├── indent-style.js │ │ ├── input-radio-req-name.js │ │ ├── input-req-label.js │ │ ├── label-req-for.js │ │ ├── lang.js │ │ ├── line-end-style.js │ │ ├── line-max-len.js │ │ ├── line-no-trailing-whitespace.js │ │ ├── link-req-noopener.js │ │ ├── raw-ignore-regex.js │ │ ├── runner.test.js │ │ ├── spec-char-escape.js │ │ ├── table-req-caption.js │ │ ├── table-req-header.js │ │ ├── tag-bans.js │ │ ├── tag-name-lowercase.js │ │ ├── tag-req-attr.js │ │ ├── title-max-len.js │ │ └── title-no-dup.js │ │ └── unit │ │ ├── htmllint.js │ │ ├── inline-config-html │ │ └── inline-all.html │ │ ├── knife.apply_rules.js │ │ ├── knife.is_labeable.js │ │ ├── knife.relative_line_col.js │ │ ├── linter.js │ │ ├── messages.js │ │ ├── parser.dom_builder.js │ │ ├── parser.js │ │ ├── raw-ignore-regex.js │ │ ├── rules.doctype-first.js │ │ ├── rules.focusable-tabindex-style.js │ │ ├── rules.js │ │ └── runner.test.js ├── cml-interface-parser │ ├── .eslintrc │ ├── .gitignore │ ├── config │ │ └── babel-parser-config.js │ ├── index.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── ast-tree-parser.js │ │ └── file-reader.js │ └── test │ │ ├── docs │ │ ├── include-interface.interface │ │ └── index.interface │ │ └── test.js ├── cml-js-parser │ ├── .eslintrc │ ├── .gitignore │ ├── config │ │ └── babel-parser-config.js │ ├── index.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── file-reader.js │ │ └── visitors │ │ │ ├── containerPathVisitor.js │ │ │ ├── exportPathVisitor.js │ │ │ └── index.js │ └── test │ │ ├── docs │ │ ├── export-class.cml │ │ └── export-default.cml │ │ └── test.js ├── cml-vue-loader │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── helpers.js │ │ ├── loader.js │ │ ├── parser.js │ │ ├── runtime │ │ │ └── component-normalizer.js │ │ ├── selector.js │ │ ├── style-compiler │ │ │ ├── index.js │ │ │ ├── load-postcss-config.js │ │ │ └── plugins │ │ │ │ ├── scope-id.js │ │ │ │ └── trim.js │ │ ├── template-compiler │ │ │ ├── index.js │ │ │ ├── modules │ │ │ │ ├── transform-require.js │ │ │ │ └── transform-srcset.js │ │ │ ├── preprocessor.js │ │ │ └── url-to-require.js │ │ └── utils │ │ │ ├── normalize.js │ │ │ ├── options-cache.js │ │ │ └── try-require.js │ ├── package-lock.json │ └── package.json ├── easy-chameleon │ ├── .babelrc │ ├── .gitignore │ ├── bin │ │ └── index.js │ ├── config │ │ ├── getWebpackConfig.js │ │ └── utils.js │ ├── entry │ │ ├── web_global.css │ │ └── web_global.js │ ├── index.js │ ├── npm-shrinkwrap.json │ ├── package.json │ └── postcss │ │ ├── web │ │ └── .postcssrc.js │ │ ├── weex │ │ └── .postcssrc.js │ │ └── wx │ │ └── .postcssrc.js ├── interface-loader │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.js │ │ └── lib │ │ │ └── check.js │ └── test │ │ └── lib.test │ │ ├── check.js │ │ ├── check.test.js │ │ ├── generator.test.js │ │ └── interface.test ├── mvvm-babel-generator │ ├── LICENSE │ ├── lib │ │ ├── buffer.js │ │ ├── generators │ │ │ ├── base.js │ │ │ ├── classes.js │ │ │ ├── expressions.js │ │ │ ├── flow.js │ │ │ ├── index.js │ │ │ ├── jsx.js │ │ │ ├── methods.js │ │ │ ├── modules.js │ │ │ ├── statements.js │ │ │ ├── template-literals.js │ │ │ ├── types.js │ │ │ └── typescript.js │ │ ├── index.js │ │ ├── node │ │ │ ├── index.js │ │ │ ├── parentheses.js │ │ │ └── whitespace.js │ │ ├── printer.js │ │ └── source-map.js │ ├── package-lock.json │ └── package.json ├── mvvm-babel-parser │ ├── .eslintrc │ ├── .gitignore │ ├── .istanbul.yml │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── lib │ │ └── index.js │ ├── package.json │ └── test │ │ ├── brace.js │ │ └── testjsx.tpl ├── mvvm-cml-loader │ ├── .eslintrc │ ├── .gitignore │ ├── helper.js │ ├── index.js │ ├── package-lock.json │ ├── package.json │ └── selector.js ├── mvvm-file-loader │ ├── README.md │ ├── dist │ │ ├── cjs.js │ │ ├── index.js │ │ └── options.json │ ├── package-lock.json │ └── package.json ├── mvvm-interface-parser │ ├── .eslintrc │ ├── .gitignore │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── check.js │ │ ├── getInterfaceCode.js │ │ ├── getInterfaceCode_old.js │ │ ├── getMethodCode.js │ │ ├── getMethodCode_old.js │ │ └── resolveRequire.js │ ├── package-lock.json │ ├── package.json │ ├── runtime │ │ ├── checkWrapper.js │ │ └── copyProto.js │ └── test │ │ ├── check.test.js │ │ ├── checkWrapper.test.js │ │ ├── copyProto.test.js │ │ ├── getInterfaceCode.test.js │ │ ├── getMethodCode.test.js │ │ └── lib │ │ └── components │ │ ├── coma │ │ ├── coma.alipay.cml │ │ ├── coma.baidu.cml │ │ ├── coma.interface │ │ ├── coma.web.cml │ │ ├── coma.weex.cml │ │ └── coma.wx.cml │ │ ├── comb │ │ ├── comb.baidu.cml │ │ └── comb.interface │ │ ├── demo-com │ │ └── demo-com.cml │ │ ├── first │ │ ├── first.interface │ │ └── test.js │ │ ├── methodinclude.interface │ │ ├── methodsrcerror.interface │ │ ├── partsrcerror.interface │ │ ├── ph-com │ │ ├── ph-com.alipay.cml │ │ ├── ph-com.baidu.cml │ │ ├── ph-com.interface │ │ ├── ph-com.web.cml │ │ ├── ph-com.weex.cml │ │ └── ph-com.wx.cml │ │ ├── second │ │ └── second.interface │ │ ├── third.interface │ │ ├── third │ │ ├── double.interface │ │ ├── includea.interface │ │ ├── includeb.interface │ │ ├── multi.interface │ │ ├── not.interface │ │ └── third.interface │ │ ├── thirdinterface.js │ │ └── thirdmethod.js ├── mvvm-miniapp-loader │ ├── .eslintrc │ ├── .gitignore │ ├── helper.js │ ├── index.js │ ├── package-lock.json │ ├── package.json │ └── selector.js ├── mvvm-pack │ ├── .eslintrc │ ├── cmlNode.js │ ├── compiler.js │ ├── index.js │ ├── lib │ │ ├── amd.js │ │ ├── amdbootstrap.global.js │ │ ├── amdbootstrap.module.js │ │ ├── amdwrapper.js │ │ └── handleScript.js │ ├── log.js │ ├── minimize │ │ ├── uglifycss.js │ │ └── uglifyjs.js │ ├── mvvmGraphPlugin.js │ ├── package-lock.json │ ├── package.json │ └── test │ │ ├── cmlNode.test.js │ │ ├── demo-project │ │ ├── .gitignore │ │ ├── chameleon.config.js │ │ ├── coma │ │ │ └── coma.interface │ │ ├── comb │ │ │ └── comb.cml │ │ ├── index.cml │ │ ├── node_modules │ │ │ ├── chameleon-ui-builtin │ │ │ │ ├── components │ │ │ │ │ ├── button │ │ │ │ │ │ ├── button.cml │ │ │ │ │ │ └── button.interface │ │ │ │ │ └── com1 │ │ │ │ │ │ └── com1.cml │ │ │ │ └── package.json │ │ │ ├── cml-pages │ │ │ │ ├── package.json │ │ │ │ └── src │ │ │ │ │ └── router.config.json │ │ │ ├── cml-subproject │ │ │ │ ├── .gitignore │ │ │ │ ├── chameleon.config.js │ │ │ │ ├── mock │ │ │ │ │ ├── api │ │ │ │ │ │ └── index.js │ │ │ │ │ └── template │ │ │ │ │ │ └── index.php │ │ │ │ ├── npm-shrinkwrap.json │ │ │ │ ├── package.json │ │ │ │ └── src │ │ │ │ │ ├── app │ │ │ │ │ └── app.cml │ │ │ │ │ ├── assets │ │ │ │ │ └── images │ │ │ │ │ │ └── chameleon.png │ │ │ │ │ ├── components │ │ │ │ │ └── demo-com │ │ │ │ │ │ └── demo-com.cml │ │ │ │ │ ├── pages │ │ │ │ │ └── index │ │ │ │ │ │ └── index.cml │ │ │ │ │ ├── router.config.json │ │ │ │ │ └── store │ │ │ │ │ ├── actions.js │ │ │ │ │ ├── getters.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── mutations.js │ │ │ │ │ └── state.js │ │ │ ├── copy-npm │ │ │ │ └── package.json │ │ │ ├── npm-components │ │ │ │ ├── components │ │ │ │ │ ├── button │ │ │ │ │ │ ├── button.cml │ │ │ │ │ │ └── button.interface │ │ │ │ │ └── com1 │ │ │ │ │ │ └── com1.cml │ │ │ │ └── package.json │ │ │ └── vant-weapp │ │ │ │ ├── test.js │ │ │ │ ├── test.json │ │ │ │ ├── test.wxml │ │ │ │ └── test.wxss │ │ ├── package.json │ │ └── src │ │ │ ├── app │ │ │ └── app.cml │ │ │ ├── components │ │ │ ├── coma │ │ │ │ └── coma.cml │ │ │ ├── comb │ │ │ │ ├── comb.interface │ │ │ │ ├── comb.web.cml │ │ │ │ └── comb.wx.cml │ │ │ └── comc │ │ │ │ └── comc.interface │ │ │ ├── pages │ │ │ ├── pagea │ │ │ │ └── pagea.cml │ │ │ └── pageb │ │ │ │ └── pageb.cml │ │ │ └── router.config.json │ │ ├── demoPlugin.js │ │ ├── lib │ │ ├── amd.test.js │ │ ├── amdbootstrap.global.test.js │ │ ├── amdbootstrap.module.test.js │ │ ├── amdwrapper.test.js │ │ ├── handleScript.node.js │ │ └── handleScript.test.js │ │ ├── log.test.js │ │ ├── mvvmGraphPlugin.test.js │ │ ├── test.wxml │ │ ├── uglifycss.test.js │ │ └── uglifyjs.test.js ├── mvvm-style-loader │ ├── index.js │ ├── lib.js │ ├── package-lock.json │ ├── package.json │ └── test │ │ ├── 1.png │ │ └── index.test.js ├── mvvm-template-parser │ ├── .eslintrc │ ├── .gitignore │ ├── README.md │ ├── index.js │ ├── lib │ │ └── process-template.js │ ├── package-lock.json │ ├── package.json │ └── test │ │ ├── index.test.js │ │ └── process-template.test.js ├── runtime-check │ ├── .eslintrc │ ├── .gitignore │ ├── getDefines.js │ ├── index.js │ ├── package-lock.json │ ├── package.json │ ├── parsePlugins.js │ └── test │ │ ├── index.test.js │ │ └── interface.test ├── url-loader │ ├── .babelrc │ ├── .circleci │ │ └── config.yml │ ├── .eslintignore │ ├── .eslintrc │ ├── .gitattributes │ ├── .github │ │ ├── CODEOWNERS │ │ ├── CONTRIBUTING.md │ │ ├── ISSUE_TEMPLATE.md │ │ └── PULL_REQUEST_TEMPLATE.md │ ├── .gitignore │ ├── .prettierrc │ ├── CHANGELOG.md │ ├── LICENSE │ ├── codecov.yml │ ├── commitlint.config.js │ ├── package-lock.json │ ├── package.json │ └── src │ │ ├── cjs.js │ │ ├── index.js │ │ ├── options.json │ │ └── utils │ │ └── normalizeFallback.js ├── webpack-check-plugin │ ├── .eslintrc │ ├── .gitignore │ ├── index.js │ ├── lib │ │ ├── check.js │ │ └── tokensMap.js │ ├── package-lock.json │ ├── package.json │ └── test │ │ └── check.test.js └── webpack-liveload-middleware │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── LICENSE │ ├── client.js │ ├── helpers.js │ ├── middleware.js │ ├── package-lock.json │ ├── package.json │ └── test │ └── helpers.test.js └── test └── test.sh /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root:true, 3 | env: { 4 | browser: true, 5 | es6: true, 6 | }, 7 | extends: [ 8 | 'standard', 9 | ], 10 | globals: { 11 | Atomics: 'readonly', 12 | SharedArrayBuffer: 'readonly' 13 | }, 14 | parserOptions: { 15 | ecmaVersion: 2018, 16 | parser:'babel-eslint' 17 | }, 18 | rules: { 19 | 'semi':[2,'always'] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.php linguist-language=JavaScript 2 | *.interface linguist-language=JavaScript 3 | *.cml linguist-language=JavaScript 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **bug描述** 11 | 描述出现的问题 12 | 13 | **复现bug的步骤** 14 | 1. Go to '...' 15 | 2. Click on '....' 16 | 3. Scroll down to '....' 17 | 4. See error 18 | 19 | **问题截图** 20 | 21 | 22 | **编译环境信息** 23 | - chameleon-tool 版本:[e.g.0.1.0] 24 | - nodejs版本、npm版本:[node v8.11.4、npm 5.6.0] 25 | - 电脑操作系统: [e.g. macOS High Sierra 10.13.6] 26 | 27 | **运行环境信息** 28 | - 端版本: [e.g. 微信小程序 7.0.3、weex 2.0、手机Safari浏览器 、PC Chrome浏览器 1.30] 29 | - 手机机型: [e.g. iPhone6 12.0] 30 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "8.10.0" 4 | before_script: 5 | - lerna bootstrap --ignore-scripts 6 | - cd packages/easy-chameleon && rm -rf node_modules && npm i && cd ../../ 7 | - cd packages/chameleon-tool && rm -rf node_modules && npm i && cd ../../ 8 | script: 9 | - npm run coverage 10 | after_script: 11 | - cat coverage/lcov.info | node_modules/.bin/codecov 12 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | //git commit -m"feat: 新增功能" 2 | //规范团队commit规范,参考commitlint-angular https://www.npmjs.com/package/@commitlint/config-angular 3 | module.exports = { 4 | extends: ['@commitlint/config-angular'], 5 | rules: { 6 | 'type-enum': [2, 'always', [ 7 | "feat", "fix", "docs", "style", "refactor", "test", "chore", "revert" 8 | ]], 9 | 'subject-full-stop': [0, 'never'], 10 | 'subject-case': [0, 'never'], 11 | } 12 | }; 13 | 14 | //[build, ci, docs, feat, fix, perf, refactor, revert, style, test] 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /elevate/cr.yml: -------------------------------------------------------------------------------- 1 | # 鲲鹏接入教程:http://wiki.intra.xiaojukeji.com/pages/viewpage.action?pageId=111903894 2 | # ---------refer用来标识此项目评审入口是OneExperience, 请勿改动--------- # 3 | refer: OE 4 | strategy: ownerOne 5 | owners: wangmengjun 6 | reviewers: 7 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "packages/*" 4 | ], 5 | "version": "1.0.8", 6 | "command": { 7 | "publish": { 8 | "allowBranch": "master", 9 | "npmClient": "npm", 10 | "verifyAccess": false, 11 | "registry": "https://registry.npmjs.org/" 12 | }, 13 | "add": { 14 | "registry": "https://registry.npmjs.org/" 15 | }, 16 | "bootstrap": { 17 | "registry": "https://registry.npmjs.org/" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /logo/active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/logo/active.png -------------------------------------------------------------------------------- /logo/cml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/logo/cml.png -------------------------------------------------------------------------------- /logo/qq2-qrcode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/logo/qq2-qrcode.jpg -------------------------------------------------------------------------------- /logo/wx-qr-code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/logo/wx-qr-code.png -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/.eslintignore: -------------------------------------------------------------------------------- 1 | **/*/__tests__ 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint-config-airbnb/base", 3 | "rules": { 4 | "no-console": [0] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | tmp 3 | node_modules 4 | coverage 5 | lib 6 | *.log 7 | *.log.* 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/.npmignore: -------------------------------------------------------------------------------- 1 | .idea 2 | tmp 3 | coverage 4 | __tests__ 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 8 4 | - 10 5 | after_success: 6 | - npm run test 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/array-expression/actual.js: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd'; 2 | 3 | var a = [Button]; 4 | var b = { 'test': [Button] }; 5 | [Button].map(function(){}); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/array-expression/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _button = _interopRequireDefault(require("antd/lib/button")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | var a = [_button.default]; 8 | var b = { 9 | 'test': [_button.default] 10 | }; 11 | [_button.default].map(function () {}); 12 | 13 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/as-arguments-identifier/actual.js: -------------------------------------------------------------------------------- 1 | import { Modal } from 'antd'; 2 | const _Modal = bind()(Modal); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/as-arguments-identifier/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _modal = _interopRequireDefault(require("antd/lib/modal")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | var _Modal = bind()(_modal.default); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/as-arguments/actual.js: -------------------------------------------------------------------------------- 1 | import { Modal } from 'antd'; 2 | const _Modal = bind({})(Modal); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/as-arguments/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _modal = _interopRequireDefault(require("antd/lib/modal")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | var _Modal = bind({})(_modal.default); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/binary-expression/actual.js: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd'; 2 | const extraProps = undefined === Button ? { type: 'primary' } : {}; 3 | console.log(extraProps); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/binary-expression/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _button = _interopRequireDefault(require("antd/lib/button")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | var extraProps = undefined === _button.default ? { 8 | type: 'primary' 9 | } : {}; 10 | console.log(extraProps); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/conditions/actual.js: -------------------------------------------------------------------------------- 1 | import { Select } from 'antd'; 2 | 3 | if (a === Select) {} 4 | if (Select) {} 5 | 6 | Select ? 'a' : 'b'; 7 | a ? Select : 2; 8 | 9 | Select || 'a'; 10 | a || Select; 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/conditions/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _select = _interopRequireDefault(require("antd/lib/select")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | if (a === _select.default) {} 8 | 9 | if (_select.default) {} 10 | 11 | _select.default ? 'a' : 'b'; 12 | a ? _select.default : 2; 13 | _select.default || 'a'; 14 | a || _select.default; -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/custom-name/actual.js: -------------------------------------------------------------------------------- 1 | import { Button } from 'plat/antd'; 2 | 3 | ReactDOM.render(
); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/custom-name/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _react = _interopRequireDefault(require("react")); 4 | 5 | var _button = _interopRequireDefault(require("antd/lib/button")); 6 | 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8 | 9 | ReactDOM.render(_react.default.createElement("div", { 10 | component: _button.default 11 | })); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/custom-style-path-ignore/actual.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDom from "react-dom"; 3 | import { Animation, Button } from "antd"; 4 | 5 | ReactDOM.render( 6 | 7 | 8 | , 9 | document.getElementById("react-container") 10 | ); 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/custom-style-path/actual.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDom from 'react-dom'; 3 | import { Button } from 'antd'; 4 | 5 | ReactDOM.render(
6 | 7 |
, document.getElementById('react-container')); 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/custom-style-path/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("antd/lib/button/style/2x"); 4 | 5 | var _button = _interopRequireDefault(require("antd/lib/button")); 6 | 7 | var _react = _interopRequireDefault(require("react")); 8 | 9 | var _reactDom = _interopRequireDefault(require("react-dom")); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | ReactDOM.render(_react.default.createElement("div", null, _react.default.createElement(_button.default, null, "xxxx")), document.getElementById('react-container')); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/execute-direct/actual.js: -------------------------------------------------------------------------------- 1 | import { message } from 'antd'; 2 | 3 | message('xxx'); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/execute-direct/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _message2 = _interopRequireDefault(require("antd/lib/message")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | (0, _message2.default)('xxx'); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/execute-member/actual.js: -------------------------------------------------------------------------------- 1 | import { message } from 'antd'; 2 | 3 | message.success('xxx'); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/execute-member/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _message2 = _interopRequireDefault(require("antd/lib/message")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | _message2.default.success('xxx'); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/export-import/actual.js: -------------------------------------------------------------------------------- 1 | import { DatePicker } from 'antd'; 2 | export default DatePicker; 3 | 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/export-import/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _datePicker = _interopRequireDefault(require("antd/lib/date-picker")); 9 | 10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11 | 12 | var _default = _datePicker.default; 13 | exports.default = _default; -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/expression-statement/actual.js: -------------------------------------------------------------------------------- 1 | import {Toast} from 'antd-mobile'; 2 | window.Toast = Toast; 3 | Toast.success('test'); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/expression-statement/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _antdMobile = require("antd-mobile"); 4 | 5 | window.Toast = _antdMobile.Toast; 6 | 7 | _antdMobile.Toast.success('test'); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/file-name/actual.js: -------------------------------------------------------------------------------- 1 | import { Select } from 'antd-mobile-fake-2.0'; 2 | 3 | if (Select) {} 4 | 5 | console.log(Select); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/file-name/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _index = _interopRequireDefault(require("antd-mobile-fake-2.0/lib/select/index.native")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | if (_index.default) {} 8 | 9 | console.log(_index.default); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/import-alias/actual.js: -------------------------------------------------------------------------------- 1 | import { Select as AntdSelect } from 'antd'; 2 | 3 | if (AntdSelect) { 4 | console.log('foo'); 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/import-alias/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _select = _interopRequireDefault(require("antd/lib/select")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | if (_select.default) { 8 | console.log('foo'); 9 | } -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/import-css/actual.js: -------------------------------------------------------------------------------- 1 | import { message } from 'antd'; 2 | import { Button } from 'antd'; 3 | 4 | message('xxx'); 5 | ReactDOM.render(
6 | 7 |
); 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/keep-named-import/actual.js: -------------------------------------------------------------------------------- 1 | import { start, end } from 'stream'; 2 | 3 | start(); 4 | end(); 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/keep-named-import/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _end2 = require("stream/lib/end"); 4 | 5 | var _start2 = require("stream/lib/start"); 6 | 7 | (0, _start2.start)(); 8 | (0, _end2.end)(); 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/material-ui/actual.js: -------------------------------------------------------------------------------- 1 | import { Toolbar } from 'material-ui'; 2 | 3 | Toolbar('xxx'); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/material-ui/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _Toolbar2 = _interopRequireDefault(require("material-ui/Toolbar")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | (0, _Toolbar2.default)('xxx'); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/member-expression/actual.js: -------------------------------------------------------------------------------- 1 | import antd from 'antd'; 2 | 3 | ReactDOM.render(
4 | Button 5 |
); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/member-expression/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _react = _interopRequireDefault(require("react")); 4 | 5 | var _button = _interopRequireDefault(require("antd/lib/button")); 6 | 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8 | 9 | ReactDOM.render(_react.default.createElement("div", null, _react.default.createElement(_button.default, { 10 | type: "primary" 11 | }, "Button"))); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/modules-false/actual.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDom from 'react-dom'; 3 | import { Button } from 'antd'; 4 | 5 | ReactDOM.render(
6 | 7 |
, document.getElementById('react-container')); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/modules-false/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("antd/lib/button/style"); 4 | 5 | var _button = _interopRequireDefault(require("antd/lib/button")); 6 | 7 | var _react = _interopRequireDefault(require("react")); 8 | 9 | var _reactDom = _interopRequireDefault(require("react-dom")); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | ReactDOM.render(_react.default.createElement("div", null, _react.default.createElement(_button.default, null, "xxxx")), document.getElementById('react-container')); 14 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/multiple-libraries-hilojs/actual.js: -------------------------------------------------------------------------------- 1 | import { Select } from 'antd'; 2 | import { Abc, Class } from 'hilojs'; 3 | 4 | if (Select) {} 5 | if (Class && Abc) {} 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/multiple-libraries-hilojs/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _abc = _interopRequireDefault(require("hilojs/abc")); 4 | 5 | var _class = _interopRequireDefault(require("hilojs/core/class")); 6 | 7 | var _select = _interopRequireDefault(require("antd/lib/select")); 8 | 9 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 10 | 11 | if (_select.default) {} 12 | 13 | if (_class.default && _abc.default) {} -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/multiple-libraries/actual.js: -------------------------------------------------------------------------------- 1 | import { Select } from 'antd'; 2 | import { Select as SelectMobile } from 'antd-mobile'; 3 | 4 | if (Select) {} 5 | if (SelectMobile) {} 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/multiple-libraries/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _select = _interopRequireDefault(require("antd-mobile/lib/select")); 4 | 5 | var _select2 = _interopRequireDefault(require("antd/lib/select")); 6 | 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8 | 9 | if (_select2.default) {} 10 | 11 | if (_select.default) {} -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/multiple-words/actual.js: -------------------------------------------------------------------------------- 1 | import { InputNumber } from 'antd'; 2 | 3 | ; 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/multiple-words/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _react = _interopRequireDefault(require("react")); 4 | 5 | var _inputNumber = _interopRequireDefault(require("antd/lib/input-number")); 6 | 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8 | 9 | _react.default.createElement(_inputNumber.default, null); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/new-expression/actual.js: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd'; 2 | new Button(); 3 | 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/new-expression/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _button = _interopRequireDefault(require("antd/lib/button")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | new _button.default(); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/object-shorthand/actual.js: -------------------------------------------------------------------------------- 1 | import { message } from 'antd'; 2 | 3 | message('xxx'); 4 | 5 | function App() { 6 | const message = 'xxx'; 7 | console.log({ message }); 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/object-shorthand/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _message2 = _interopRequireDefault(require("antd/lib/message")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | (0, _message2.default)('xxx'); 8 | 9 | function App() { 10 | var message = 'xxx'; 11 | console.log({ 12 | message: message 13 | }); 14 | } -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/property/actual.js: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd'; 2 | 3 | ReactDOM.render(
); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/property/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _react = _interopRequireDefault(require("react")); 4 | 5 | var _button = _interopRequireDefault(require("antd/lib/button")); 6 | 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8 | 9 | ReactDOM.render(_react.default.createElement("div", { 10 | component: _button.default 11 | })); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/react-element/actual.js: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd'; 2 | 3 | ReactDOM.render(
4 | 5 |
); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/react-element/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _react = _interopRequireDefault(require("react")); 4 | 5 | var _button = _interopRequireDefault(require("antd/lib/button")); 6 | 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8 | 9 | ReactDOM.render(_react.default.createElement("div", null, _react.default.createElement(_button.default, null, "xxxx"))); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/react-toolbox/actual.js: -------------------------------------------------------------------------------- 1 | import { AppBar } from 'react-toolbox'; 2 | 3 | AppBar('xxx'); 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/react-toolbox/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _app_bar = _interopRequireDefault(require("react-toolbox/lib/app_bar")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | (0, _app_bar.default)('xxx'); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/return/actual.js: -------------------------------------------------------------------------------- 1 | import { toast } from 'antd'; 2 | 3 | function a() { 4 | return toast; 5 | } 6 | 7 | function b(toast) { 8 | return toast; 9 | } 10 | 11 | function c() { 12 | var toast = 'toast'; 13 | return toast; 14 | } 15 | 16 | function d() { 17 | var toast = 'toast'; 18 | return function () { 19 | return toast; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/return/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _toast2 = _interopRequireDefault(require("antd/lib/toast")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | function a() { 8 | return _toast2.default; 9 | } 10 | 11 | function b(toast) { 12 | return toast; 13 | } 14 | 15 | function c() { 16 | var toast = 'toast'; 17 | return toast; 18 | } 19 | 20 | function d() { 21 | var toast = 'toast'; 22 | return function () { 23 | return toast; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/specifier-alias/actual.js: -------------------------------------------------------------------------------- 1 | import { Button as Button1 } from 'antd'; 2 | 3 | const foo = Button1.foo 4 | 5 | ReactDOM.render(
6 | xxxx 7 |
); 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/specifier-alias/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _react = _interopRequireDefault(require("react")); 4 | 5 | var _button = _interopRequireDefault(require("antd/lib/button")); 6 | 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8 | 9 | var foo = _button.default.foo; 10 | ReactDOM.render(_react.default.createElement("div", null, _react.default.createElement(_button.default, null, "xxxx"))); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/use-multiple-times/actual.js: -------------------------------------------------------------------------------- 1 | import a from 'a'; 2 | import { Button } from 'antd-mobile'; 3 | 4 | a(Button); 5 | a(Button); 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/use-multiple-times/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _button = _interopRequireDefault(require("antd-mobile/lib/button")); 4 | 5 | var _a = _interopRequireDefault(require("a")); 6 | 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8 | 9 | (0, _a.default)(_button.default); 10 | (0, _a.default)(_button.default); -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/variable-declarator/actual.js: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd'; 2 | 3 | const a = Button; 4 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/variable-declarator/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _button = _interopRequireDefault(require("antd/lib/button")); 4 | 5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6 | 7 | var a = _button.default; -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/variable-scope/actual.js: -------------------------------------------------------------------------------- 1 | import { message } from 'antd'; 2 | 3 | message('xxx'); 4 | 5 | function App() { 6 | const message = 'xxx'; 7 | return
{message}
; 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-chameleon-import/test/fixtures/variable-scope/expected.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _react = _interopRequireDefault(require("react")); 4 | 5 | var _message2 = _interopRequireDefault(require("antd/lib/message")); 6 | 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8 | 9 | (0, _message2.default)('xxx'); 10 | 11 | function App() { 12 | var message = 'xxx'; 13 | return _react.default.createElement("div", null, message); 14 | } -------------------------------------------------------------------------------- /packages/chameleon-css-loader/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-css-loader/.gitignore -------------------------------------------------------------------------------- /packages/chameleon-css-loader/handler/lines.js: -------------------------------------------------------------------------------- 1 | // 静态编译和运行时 web和小程序端对lines属性特殊处理 2 | 3 | module.exports = function(linesNumber) { 4 | // 作为一个属性注意最后不能添加分号 5 | return `display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: ${linesNumber}; overflow: hidden` 6 | } 7 | -------------------------------------------------------------------------------- /packages/chameleon-css-loader/parser/web.js: -------------------------------------------------------------------------------- 1 | 2 | const cpx = require('../postcss/cpx.js'); 3 | const postcss = require('postcss'); 4 | const px2rem = require('postcss-plugin-px2rem'); 5 | const weexPlus = require('../postcss/weex-plus'); 6 | module.exports = function(source, options = {}) { 7 | if (options.rem === true) { 8 | return postcss([px2rem(options.remOptions), weexPlus()]).process(source).css; 9 | } else { 10 | options.cpxType = 'scale'; 11 | return postcss([cpx(options), weexPlus()]).process(source).css; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/chameleon-css-loader/parser/weex.js: -------------------------------------------------------------------------------- 1 | 2 | const weex = require('../postcss/weex.js'); 3 | module.exports = function(source, options = {}) { 4 | return weex(source, options); 5 | } 6 | -------------------------------------------------------------------------------- /packages/chameleon-css-loader/test/transform/weex.test.js: -------------------------------------------------------------------------------- 1 | const parseCss = require('../../transform/weex.js'); 2 | const expect = require('chai').expect; 3 | let source = `width:75cpx;border:1cpx solid red;`; 4 | 5 | 6 | describe('parse/weex', function() { 7 | it('if options.rem to be truthy ,parse px to rem,else multiply the px value by options.scale', function() { 8 | let result = parseCss.parse(source);// body {width:1rem;} 9 | console.log(result); 10 | expect(/75px/.test(result)).to.be.ok; 11 | expect(/1px/.test(result)).to.be.ok; 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /packages/chameleon-css-loader/test/utils.test.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const utils = require('../utils.js'); 4 | const expect = require('chai').expect; 5 | 6 | 7 | describe('utils', function() { 8 | it('transform singlequot to doublequot', function() { 9 | expect(utils.singlequot2doublequot(`'`)).to.be.equal(`"`); 10 | }); 11 | it('unique cssStyleValue ', function() { 12 | expect(utils.uniqueStyle(`width:300px;width:300px`)).to.be.equal(`width:300px`) 13 | }); 14 | it('disappearCssComment', function() { 15 | expect(utils.disappearCssComment(`/*width:300px;*/`)).to.be.empty; 16 | }) 17 | }) 18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/chameleon-dev-proxy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chameleon-dev-proxy", 3 | "version": "1.0.8", 4 | "description": "cml开发环境代理服务模块", 5 | "main": "index.js", 6 | "author": "Chameleon-Team", 7 | "license": "Apache", 8 | "mail": "ChameleonCore@didiglobal.com", 9 | "dependencies": { 10 | "babel-polyfill": "^6.26.0", 11 | "node-mitmproxy": "^3.1.0", 12 | "qrcode-terminal": "^0.12.0" 13 | }, 14 | "gitHead": "5ddcde4330774710f7646559446e008f7785ce00" 15 | } -------------------------------------------------------------------------------- /packages/chameleon-errors-webpack-plugin/index.js: -------------------------------------------------------------------------------- 1 | 2 | const FriendlyErrorsWebpackPlugin = require('./src/friendly-errors-plugin'); 3 | 4 | module.exports = FriendlyErrorsWebpackPlugin; -------------------------------------------------------------------------------- /packages/chameleon-errors-webpack-plugin/src/transformers/esLintError.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function isEslintError (e) { 4 | return e.originalStack 5 | .some(stackframe => stackframe.fileName && stackframe.fileName.indexOf('eslint-loader') > 0); 6 | } 7 | 8 | function transform(error) { 9 | if (isEslintError(error)) { 10 | return Object.assign({}, error, { 11 | name: 'Lint error', 12 | type: 'lint-error', 13 | }); 14 | } 15 | 16 | return error; 17 | } 18 | 19 | module.exports = transform; 20 | -------------------------------------------------------------------------------- /packages/chameleon-linter/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .vscode 3 | .nyc_output 4 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // json校验 3 | json: require('./json'), 4 | 5 | // 脚本校验 6 | script: require('./script'), 7 | 8 | // 样式校验 9 | style: require('./style'), 10 | 11 | // 模板校验 12 | Template: require('./template') 13 | }; 14 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/js-ast-parser.js: -------------------------------------------------------------------------------- 1 | const CmlJsAstTreeParser = require('cml-js-parser'); 2 | const config = require('../../../config'); 3 | 4 | function getParseResults(astTree) { 5 | let parser = new CmlJsAstTreeParser({astTree}, config.getParserConfig().script); 6 | return parser.getParseResults(); 7 | } 8 | 9 | module.exports = { 10 | getParseResults 11 | } 12 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/template-ast-parser/options.js: -------------------------------------------------------------------------------- 1 | const _options = { 2 | langs: ['cml', 'vue'], 3 | cmlSystemVarNames: ['$event', 'Math', 'Date'], 4 | vueSystemVarNames: ['$event', 'Math', 'Date'] 5 | } 6 | 7 | module.exports.getOption = function(optName) { 8 | return _options[optName]; 9 | } 10 | 11 | module.exports.getAllOptions = function() { 12 | return {..._options}; 13 | } 14 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/template-ast-parser/rules/component/index.js: -------------------------------------------------------------------------------- 1 | const bulk = require('bulk-require'); 2 | const ruleExports = bulk(__dirname, '!(index).js'); 3 | 4 | module.exports = Object.values(ruleExports); 5 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/template-ast-parser/rules/template/index.js: -------------------------------------------------------------------------------- 1 | const bulk = require('bulk-require'); 2 | const ruleExports = bulk(__dirname, '!(index).js'); 3 | 4 | module.exports = Object.values(ruleExports); 5 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/template-ast-parser/tools/dash-to-camelcase.js: -------------------------------------------------------------------------------- 1 | module.exports.dashtoCamelcase = function(str = '') { 2 | return str && str.replace(/-(\w)/g, (all, letter) => letter.toUpperCase()); 3 | } 4 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/template-ast-parser/tools/flat-array.js: -------------------------------------------------------------------------------- 1 | module.exports.flatArray = function(arr) { 2 | let tempArr = []; 3 | if (Array.isArray(arr)) { 4 | arr.forEach((item) => { 5 | if (Array.isArray(item)) { 6 | tempArr.push(...item); 7 | } else { 8 | tempArr.push(item); 9 | } 10 | }); 11 | } 12 | return tempArr; 13 | } 14 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/template-ast-parser/tools/get-offset-pos-from-text.js: -------------------------------------------------------------------------------- 1 | module.exports.getVarOffsetPosFromText = function (text = '', varName = '', offset = 0) { 2 | if (!text || !varName) {return [1, 0];} 3 | let preText = text.substr(0, text.indexOf(varName, offset)); 4 | let lines = preText.split('\n'); 5 | return [lines.length - 1, lines[lines.length - 1].length]; 6 | } 7 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/template-ast-parser/tools/index.js: -------------------------------------------------------------------------------- 1 | const bulk = require('bulk-require'); 2 | const toolExports = bulk(__dirname, '!(index).js'); 3 | let tools = {}; 4 | 5 | Object.values(toolExports).forEach(tool => { 6 | Object.assign(tools, tool); 7 | }); 8 | 9 | module.exports = tools; 10 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/template-ast-parser/tools/is-origin-component.js: -------------------------------------------------------------------------------- 1 | module.exports.isOriginComponent = function(tag) { 2 | return tag ? /^origin-\w+/.test(tag.name) : false; 3 | } 4 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/template-ast-parser/tools/is-suspicious-textnode.js: -------------------------------------------------------------------------------- 1 | const suspiciousRegexes = { 2 | cml: /{{(.*?)}}/g, 3 | vue: /{{(.*?)}}/g, 4 | wx: /{{(.*?)}}/g 5 | }; 6 | 7 | module.exports.isSuspiciousTextnode = function({lang = 'cml', text = ''}) { 8 | return suspiciousRegexes[lang].test(text); 9 | } 10 | -------------------------------------------------------------------------------- /packages/chameleon-linter/checkers/template/lib/template-ast-parser/tools/rule-filter-match.js: -------------------------------------------------------------------------------- 1 | module.exports.isRuleMatch = function(node, rule) { 2 | return node && rule && rule.filter && rule.filter.run(node[rule.filter.key]); 3 | } 4 | -------------------------------------------------------------------------------- /packages/chameleon-linter/classes/message.js: -------------------------------------------------------------------------------- 1 | /** 2 | * A class represents an error message. 3 | */ 4 | class Message { 5 | constructor({ line = undefined, column = undefined, token = '', msg = '' }) { 6 | this.line = line; 7 | this.column = column; 8 | this.token = token; 9 | this.msg = msg || 'An unknown error occurred' 10 | } 11 | } 12 | 13 | module.exports = Message; 14 | -------------------------------------------------------------------------------- /packages/chameleon-linter/config/.cmllintrc: -------------------------------------------------------------------------------- 1 | { 2 | // 核心文件检查 3 | 'core-files-check': true, 4 | 5 | // cml文件校验 6 | 'cml-files-check': true, 7 | 8 | // 接口文件校验 9 | 'interface-files-check': true, 10 | 11 | 'cpx-support': true, 12 | 13 | 'platforms': ['weex', 'wx', 'web', 'baidu', 'alipay'] 14 | } 15 | -------------------------------------------------------------------------------- /packages/chameleon-linter/config/common-events.json: -------------------------------------------------------------------------------- 1 | { 2 | "events": ["tap", "click", "touchstart", "touchmove", "touchend"] 3 | } -------------------------------------------------------------------------------- /packages/chameleon-linter/config/fakeComps/index.js: -------------------------------------------------------------------------------- 1 | const list = [{ 2 | name: 'app', 3 | allowAttrs: { 4 | vars: ['routerConfig'], 5 | methods: [], 6 | props: [{ 7 | name: 'routerConfig', 8 | required: false 9 | }], 10 | events: [] 11 | } 12 | }]; 13 | 14 | module.exports = list; 15 | -------------------------------------------------------------------------------- /packages/chameleon-linter/config/tag-embed-rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "text": { 3 | "required": "", 4 | "excludes": "", 5 | "includes": ["text"] 6 | }, 7 | "scroller": { 8 | "required": "", 9 | "excludes": ["textarea","video"], 10 | "includes": "" 11 | }, 12 | "list": { 13 | "required": "", 14 | "excludes": ["textarea","video"], 15 | "includes": "" 16 | }, 17 | "video": { 18 | "required": "", 19 | "excludes": "", 20 | "includes": ["text"] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/chameleon-linter/config/white-list/vue-white-list.js: -------------------------------------------------------------------------------- 1 | /** 2 | * tags: Technically, it only holds tags that are not a html tag. 3 | */ 4 | module.exports = { 5 | attrs: ['v-if', 'v-else', 'v-else-if', 'v-for', 'v-on', 'v-bind', 'v-html', 'v-show', 'v-model', 'v-pre', 'v-once', 'slot-scope'], 6 | tags: ['template', 'view', 'text', 'block', 'scroller', 'list', 'cell', 'image', 'switch', 'video', 'input', 'button', 'radio', 'checkbox', 'page', 'router-view', 'slot'] 7 | } 8 | -------------------------------------------------------------------------------- /packages/chameleon-linter/config/white-list/weex-white-list.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | attrs: ['v-if', 'v-else', 'v-else-if', 'v-for', 'v-on', 'v-bind', 'v-html', 'v-show', 'v-model', 'v-pre', 'v-once', 'slot-scope', 'is'], 3 | tags: ['a', 'div', 'image', 'indicator', 'input', 'list', 'cell', 'recycle-list', 'loading', 'refresh', 'scroller', 'slider', 'textarea', 'text', 'richtext', 'video', 'waterfall', 'web'] 4 | } 5 | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/cml-file-specification.md: -------------------------------------------------------------------------------- 1 | # cml文件规范 2 | 3 | ``` 4 | ├── components 5 | │ ├── c-title 6 | │ │ ├── c-title.web.cml 7 | │ │ ├── c-title.weex.cml 8 | │ │ └── c-title.wx.cml 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/buildin/button.md: -------------------------------------------------------------------------------- 1 | # button 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |text|String| | 7 | |size|String| | 8 | |type|String| | 9 | |disabled|Boolean| | 10 | |btnStyle|String| | 11 | |textStyle|String| | 12 | |disabledStyle|String| | 13 | |c-bind:onclick|EventHandle|事件返回参数 eventDetail [类型: EventDetail]
其中 EventDetail 的定义为
 {type: String , disabled: Boolean}
| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/buildin/checkbox.md: -------------------------------------------------------------------------------- 1 | # checkbox 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |checked|Boolean| | 7 | |label|String| | 8 | |disabled|Boolean| | 9 | |position|String| | 10 | |groupIndex|Number| | 11 | |c-bind:changeevent|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/buildin/list.md: -------------------------------------------------------------------------------- 1 | # list 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |bottomOffset|Number| | 7 | |c-bind:customscroll|EventHandle|事件返回参数 eventDetail [类型: scrollDetail]
其中 scrollDetail 的定义为
 {scrollHeight: Number , scrollLeft: Number , scrollTop: Number , scrollWidth: Number}
| 8 | |c-bind:scrolltobottom|EventHandle|事件返回参数 eventDetail [类型: bottomDetail]
其中 bottomDetail 的定义为
 {direction: String}
| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/buildin/page.md: -------------------------------------------------------------------------------- 1 | # page 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |title|String| | 7 | |c-bind:back|EventHandle|事件未定义返回参数| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/buildin/radio.md: -------------------------------------------------------------------------------- 1 | # radio 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |checked|Boolean| | 7 | |label|String| | 8 | |disabled|Boolean| | 9 | |position|String| | 10 | |groupIndex|Number| | 11 | |c-bind:changeevent|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/buildin/richtext.md: -------------------------------------------------------------------------------- 1 | # richtext 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |richData|richData|其中 richData 的定义为
 {message: String , rich_message: richMessageArray}
其中 richMessageArray 的定义为
 [richConfig]
其中 richConfig 的定义为
 {color: String , font_size: Number , start: Number , end: Number}| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/buildin/scroller.md: -------------------------------------------------------------------------------- 1 | # scroller 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |cstyle|String| | 7 | |bottomOffset|Number| | 8 | |scrollDirection|String| | 9 | |c-bind:customscroll|EventHandle|事件返回参数 eventDetail [类型: scrollEventDetail]
其中 scrollEventDetail 的定义为
 {deltaX: Number , deltaY: Number , scrollHeight: Number , scrollLeft: Number , scrollTop: Number , scrollWidth: Number}
| 10 | |c-bind:scrolltobottom|EventHandle|事件返回参数 eventDetail [类型: scrolltobottomEventDetail]
其中 scrolltobottomEventDetail 的定义为
 {direction: String}
| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/buildin/switch.md: -------------------------------------------------------------------------------- 1 | # switch 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |checked|Boolean| | 7 | |disabled|Boolean| | 8 | |label|String| | 9 | |c-bind:changeevent|EventHandle|事件返回参数 eventDetail [类型: valueDetail]
其中 valueDetail 的定义为
 {value: Boolean}
| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/buildin/video.md: -------------------------------------------------------------------------------- 1 | # video 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |controls|Boolean| | 7 | |autoplay|Boolean| | 8 | |loop|Boolean| | 9 | |src|String| | 10 | |c-bind:customstart|EventHandle|事件未定义返回参数| 11 | |c-bind:custompause|EventHandle|事件未定义返回参数| 12 | |c-bind:customfinish|EventHandle|事件未定义返回参数| 13 | |c-bind:customfail|EventHandle|事件未定义返回参数| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-actionsheet.md: -------------------------------------------------------------------------------- 1 | # c-actionsheet 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |show|Boolean| | 7 | |title|String| | 8 | |cancelTxt|String| | 9 | |headerStyle|String| | 10 | |cancelStyle|String| | 11 | |contentStyle|String| | 12 | |activeStyle|String| | 13 | |data|Array| | 14 | |pickerStyle|Boolean| | 15 | |active|Number| | 16 | |c-bind:cancel|EventHandle|待填写| 17 | |c-bind:select|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-aside.md: -------------------------------------------------------------------------------- 1 | # c-aside 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |asideStyle|String| | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-checkbox-group.md: -------------------------------------------------------------------------------- 1 | # c-checkbox-group 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |option|Array| | 7 | |position|String| | 8 | |horizontal|Boolean| | 9 | |c-bind:groupchange|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-col.md: -------------------------------------------------------------------------------- 1 | # c-col 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |width|Number| | 7 | |height|Number| | 8 | |backgroundColor|String| | 9 | |margin|Number| | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-container.md: -------------------------------------------------------------------------------- 1 | # c-container 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |direction|String| | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-dialog.md: -------------------------------------------------------------------------------- 1 | # c-dialog 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |show|Boolean| | 7 | |mask|Boolean| | 8 | |title|String| | 9 | |content|String| | 10 | |type|String| | 11 | |showClose|Boolean| | 12 | |closeSrc|String| | 13 | |cancelText|String| | 14 | |confirmText|String| | 15 | |iconType|String| | 16 | |iconUrl|String| | 17 | |iconStyle|Object| | 18 | |c-bind:show|EventHandle|待填写| 19 | |c-bind:cancel|EventHandle|待填写| 20 | |c-bind:confirm|EventHandle|待填写| 21 | |c-bind:close|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-foot.md: -------------------------------------------------------------------------------- 1 | # c-foot 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |footStyle|String| | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-form-item.md: -------------------------------------------------------------------------------- 1 | # c-form-item 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |label|String| | 7 | |justify|String| | 8 | |align|String| | 9 | |labelClass|String| | 10 | |labelStyle|Object| | 11 | |contentClass|String| | 12 | |contentStyle|Object| | 13 | |errorClass|String| | 14 | |errorStyle|Object| | 15 | |rules|Array| | 16 | |required|Boolean| | 17 | |feedback|String| | 18 | |validateStatus|String| | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-form.md: -------------------------------------------------------------------------------- 1 | # c-form 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |model|Object| | 7 | |labelWidth|String| | 8 | |labelPosition|String| | 9 | |rules|Array| | 10 | |inline|Boolean| | 11 | |submit|Function| | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-head.md: -------------------------------------------------------------------------------- 1 | # c-head 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |headStyle|String| | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-main.md: -------------------------------------------------------------------------------- 1 | # c-main 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |mainStyle|String| | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-picker-item.md: -------------------------------------------------------------------------------- 1 | # c-picker-item 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |data|ArrayType|其中 ArrayType 的定义为
 [String]| 7 | |defaultIndex|Number| | 8 | |height|Number| | 9 | |textAlign|String| | 10 | |c-bind:selectchange|EventHandle|事件返回参数 eventDetail [类型: EventDetail]
其中 EventDetail 的定义为
 {index: Number}
| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-picker-panel.md: -------------------------------------------------------------------------------- 1 | # c-picker-panel 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |show|Boolean| | 7 | |height|Number| | 8 | |title|String| | 9 | |headerHeight|Number| | 10 | |cancelBtnStyle|String| | 11 | |confirmBtnStyle|String| | 12 | |c-bind:cancel|EventHandle|事件未定义返回参数| 13 | |c-bind:confirm|EventHandle|事件未定义返回参数| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-picker.md: -------------------------------------------------------------------------------- 1 | # c-picker 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |show|Boolean| | 7 | |height|Number| | 8 | |headerHeight|Number| | 9 | |textAlign|String| | 10 | |dataScrollerHeight|Number| | 11 | |data|Array| | 12 | |defaultIndex|Number| | 13 | |cancelBtnStyle|String| | 14 | |confirmBtnStyle|String| | 15 | |c-bind:cancel|EventHandle|待填写| 16 | |c-bind:confirm|EventHandle|待填写| 17 | |c-bind:selectchange|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-popup.md: -------------------------------------------------------------------------------- 1 | # c-popup 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |mask|Boolean| | 7 | |show|Boolean| | 8 | |center|Boolean| | 9 | |position|String| | 10 | |c-bind:close|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-radio-group.md: -------------------------------------------------------------------------------- 1 | # c-radio-group 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |option|Array| | 7 | |position|String| | 8 | |horizontal|Boolean| | 9 | |c-bind:groupchange|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-refresh.md: -------------------------------------------------------------------------------- 1 | # c-refresh 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |display|Boolean| | 7 | |direction|String| | 8 | |customUi|Boolean| | 9 | |c-bind:refreshevent|EventHandle|事件返回参数 eventDetail [类型: valueDetail]
其中 valueDetail 的定义为
 {value: Boolean}
| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-row.md: -------------------------------------------------------------------------------- 1 | # c-row 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |justify|String| | 7 | |align|String| | 8 | |height|Number| | 9 | |wrap|Boolean| | 10 | |margin|Number| | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-tab-pane-item.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-linter/docs/components/chameleon-ui/c-tab-pane-item.md -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-tab-pane.md: -------------------------------------------------------------------------------- 1 | # c-tab-pane 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |tabs|Array| | 7 | |activeLabel|Array| | -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-tabs-item.md: -------------------------------------------------------------------------------- 1 | # c-tabs-item 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |tab|Object| | 7 | |inline|Boolean| | 8 | |activeLabel|String| | 9 | |activeLabelStyle|String| | 10 | |c-bind:tabclick|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-tabs.md: -------------------------------------------------------------------------------- 1 | # c-tabs 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |tabs|Array| | 7 | |activeLabel|String| | 8 | |inline|Boolean| | 9 | |lineStyle|String| | 10 | |activeLabelStyle|String| | 11 | |c-bind:tabclick|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-tip.md: -------------------------------------------------------------------------------- 1 | # c-tip 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |show|Boolean| | 7 | |direction|String| | 8 | |closeUrl|String| | 9 | |offsetLeft|Number| | 10 | |offsetTop|Number| | 11 | |offsetRight|Number| | 12 | |offsetBottom|Number| | 13 | |c-bind:close|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/components/chameleon-ui/c-toast.md: -------------------------------------------------------------------------------- 1 | # c-toast 2 | --- 3 | 4 | |属性名|类型|说明| 5 | | ------ | ------ | ------ | 6 | |type|String| | 7 | |message|String| | 8 | |duration|Number| | 9 | |show|Boolean| | 10 | |mask|Boolean| | 11 | |needIcon|Boolean| | 12 | |c-bind:show|EventHandle|待填写| -------------------------------------------------------------------------------- /packages/chameleon-linter/docs/directory-specification.md: -------------------------------------------------------------------------------- 1 | # 目录规范 2 | 3 | ``` 4 | ├── chameleon.config.js //项目的配置文件 5 | ├── dist //打包产出目录 6 | ├── mock //模拟数据目录 7 | ├── node_modules //npm包依赖 8 | ├── package.json 9 | └── src //项目源代码 10 | ├── app //app入口 11 | ├── components //组件文件夹 12 | ├── pages //页面文件夹 13 | ├── router.config.json //路由配置文件 14 | └── store //全局状态管理 15 | ``` 16 | -------------------------------------------------------------------------------- /packages/chameleon-linter/linters/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | stylelint: require('./style'), 3 | templatelint: require('./template'), 4 | scriptlint: require('./script'), 5 | jsonlint: require('./json') 6 | }; 7 | 8 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/json/nonstandard.cml: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/json/standard.cml: -------------------------------------------------------------------------------- 1 | 20 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/script/include/include-interface-fail.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/script/include/include-src-cml-fail.interface: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/script/include/include-src-cml-mis-prop-fail.interface: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/script/include/include-src-js-class-name-fail.interface: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/script/include/include-src-js-fail.interface: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/script/include/include-src-js-mis-prop-fail.interface: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/script/include/origin-comp-interface.interface: -------------------------------------------------------------------------------- 1 | 23 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/script/include/src/someplatform-mis-class.js: -------------------------------------------------------------------------------- 1 | class Method implements ExtendInterfaceInterface { 2 | getMsg(msg) { 3 | return 'web:' + msg; 4 | } 5 | } 6 | 7 | export default new Method(); 8 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/checker/cml/script/include/src/someplatform-mis-prop.js: -------------------------------------------------------------------------------- 1 | class Method implements OnlyInterfaceInterface { 2 | getMsg(msg) { 3 | return 'web:' + msg; 4 | } 5 | } 6 | 7 | export default new Method(); 8 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/core/standard/src/router.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "history", 3 | "domain": "https://api.chameleon.com", 4 | "routes":[ 5 | { 6 | "url": "/beatles/h5/user/user/homev2", 7 | "path": "pages/index/index", 8 | "name": "我的主页", 9 | "mock": "index.php" 10 | }, 11 | { 12 | "url": "/beatles/h5/errorpage", 13 | "path": "pages/error_page/error_page", 14 | "name": "出错啦", 15 | "mock": "errorpage.php" 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/chameleon-linter/test/core/standard/src/store/index.js: -------------------------------------------------------------------------------- 1 | import actions from './actions' 2 | import getters from './getters' 3 | import state from './state' 4 | import mutations from './mutations' 5 | 6 | import createStore from "chameleon-store"; 7 | 8 | export default createStore({ 9 | actions, 10 | getters, 11 | state, 12 | mutations 13 | }) 14 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/json/.cmllintrc: -------------------------------------------------------------------------------- 1 | { 2 | // 核心文件检查 3 | 'core-files-check': true, 4 | 5 | // cml文件校验 6 | 'cml-files-check': true, 7 | 8 | // 接口文件校验 9 | 'interface-files-check': true, 10 | 11 | 'cpx-support': true, 12 | 13 | 'platforms': ['weex', 'wx', 'web', 'baidu', 'alipay'] 14 | } 15 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/json/no-bracket.cml: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/json/no-comma.cml: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/json/no-quotes.cml: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/json/standard.cml: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/style/.cmllintrc: -------------------------------------------------------------------------------- 1 | { 2 | // 核心文件检查 3 | 'core-files-check': true, 4 | 5 | // cml文件校验 6 | 'cml-files-check': true, 7 | 8 | // 接口文件校验 9 | 'interface-files-check': true, 10 | 11 | 'cpx-support': true, 12 | 13 | 'platforms': ['weex', 'wx', 'web', 'baidu', 'alipay'] 14 | } 15 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/style/no-bracket.cml: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/style/no-semicolon.cml: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/style/no-standard-important.cml: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/style/no-standard.stylus.cml: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/style/standard.cml: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/linter/cml/style/standard.stylus.cml: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/lintrc/nonstandard/.cmllintrc: -------------------------------------------------------------------------------- 1 | { 2 | 3 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/lintrc/standard/.cmllintrc: -------------------------------------------------------------------------------- 1 | { 2 | 'core-files-check': false, 3 | } 4 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/docs/node_modules/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-linter/test/template/docs/node_modules/.DS_Store -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/docs/node_modules/@didi/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-linter/test/template/docs/node_modules/@didi/.DS_Store -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/docs/node_modules/@didi/chameleon-ui-builtin/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-linter/test/template/docs/node_modules/@didi/chameleon-ui-builtin/.DS_Store -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/docs/node_modules/@didi/chameleon-ui-builtin/components/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-linter/test/template/docs/node_modules/@didi/chameleon-ui-builtin/components/.DS_Store -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/docs/node_modules/chameleon-ui-builtin/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-linter/test/template/docs/node_modules/chameleon-ui-builtin/.DS_Store -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/docs/node_modules/chameleon-ui-builtin/components/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-linter/test/template/docs/node_modules/chameleon-ui-builtin/components/.DS_Store -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/fail/index.js: -------------------------------------------------------------------------------- 1 | const bulk = require('bulk-require'); 2 | const casesExports = bulk(__dirname, '!(index).js'); 3 | 4 | const entries = Object.keys(casesExports); 5 | 6 | module.exports = entries.reduce((cases, currentEntry) => { 7 | return cases.concat(casesExports[currentEntry]); 8 | }, []); 9 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/fail/lang-error.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'should fail template lang error', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: "", 7 | params: { 8 | lang: '' 9 | }, 10 | file: '/src/app.cml' 11 | }, 12 | jsonAst: {} 13 | }, 14 | output: { 15 | start: 0, 16 | messages: [{ 17 | line: 1, 18 | column: 16, 19 | msg: 'the tag template lang attribute: "web" is not valid', 20 | token: '' 21 | }] 22 | } 23 | }]; 24 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/fail/template-tag-error.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'should fail template tag check', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: '', 7 | params: { 8 | lang: '' 9 | } 10 | }, 11 | jsonAst: {} 12 | }, 13 | output: { 14 | start: 0, 15 | messages: [{ 16 | line: 1, 17 | column: 0, 18 | msg: 'Each template can only have one group of template tags', 19 | token: 'template' 20 | }] 21 | } 22 | }]; 23 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/fail/usingcomponent-ref-error.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'should fail usingComponents check', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: '', 7 | params: { 8 | lang: '' 9 | } 10 | }, 11 | jsonAst: {} 12 | }, 13 | output: { 14 | start: 0, 15 | messages: [{ 16 | line: 1, 17 | column: 11, 18 | msg: 'tag: "c-geerup" is either not allowed in this template or not referenced as a component', 19 | token: 'c-geerup' 20 | }] 21 | } 22 | }]; 23 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/pass/built-in-embed-rule-excludes-pass.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'should pass built-in components emebed rule: excludes check', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: '', 7 | params: { 8 | lang: '' 9 | } 10 | }, 11 | jsonAst: {} 12 | }, 13 | output: { 14 | start: 0, 15 | messages: [] 16 | } 17 | }]; 18 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/pass/built-in-embed-rule-includes-pass.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'should pass built-in components emebed rule: includes check', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: '', 7 | params: { 8 | lang: '' 9 | } 10 | }, 11 | jsonAst: {} 12 | }, 13 | output: { 14 | start: 0, 15 | messages: [] 16 | } 17 | }]; 18 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/pass/component-is-pass.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'should pass component is attribute check', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: ["'].join('\n'), 9 | params: { 10 | lang: '' 11 | } 12 | }, 13 | jsonAst: {} 14 | }, 15 | output: { 16 | start: 0, 17 | messages: [] 18 | } 19 | }]; 20 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/pass/index.js: -------------------------------------------------------------------------------- 1 | const bulk = require('bulk-require'); 2 | const passExports = bulk(__dirname, '!(index).js'); 3 | 4 | const entries = Object.keys(passExports); 5 | 6 | module.exports = entries.reduce((cases, currentEntry) => { 7 | if (currentEntry === 'tag-close') { 8 | return cases.concat(passExports[currentEntry]); 9 | } else { 10 | return cases; 11 | } 12 | }, []); 13 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/pass/lang-pass.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'should pass template lang error', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: "", 7 | params: { 8 | lang: '' 9 | } 10 | }, 11 | jsonAst: {} 12 | }, 13 | output: { 14 | start: 0, 15 | messages: [] 16 | } 17 | }]; 18 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/pass/origin-component-skip-rules-pass.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'origin component passes emebed rule: excludes check', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: '', 7 | params: { 8 | lang: '' 9 | } 10 | }, 11 | jsonAst: {} 12 | }, 13 | output: { 14 | start: 0, 15 | messages: [] 16 | } 17 | }]; 18 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/pass/platform-specific-tags-pass.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'should pass platform specific tags check', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: '', 7 | platformType: 'wx', 8 | params: { 9 | lang: 'cml' 10 | } 11 | }, 12 | jsonAst: {} 13 | }, 14 | output: { 15 | start: 0, 16 | messages: [] 17 | } 18 | }]; 19 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/pass/tag-close.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'should pass tag-close check', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: ["'].join('\n'), 9 | params: { 10 | lang: '' 11 | } 12 | }, 13 | jsonAst: {} 14 | }, 15 | output: { 16 | start: 0, 17 | messages: [] 18 | } 19 | }]; 20 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/template/linter/cases/pass/usingcomponent-ref-pass.js: -------------------------------------------------------------------------------- 1 | module.exports = [{ 2 | desc: 'should pass usingComponents check', 3 | input: { 4 | part: { 5 | line: 0, 6 | rawContent: '', 7 | params: { 8 | lang: '' 9 | } 10 | }, 11 | jsonAst: { 12 | base: { 13 | usingComponents: { 14 | 'c-geerup': 'path/to/geerup' 15 | } 16 | } 17 | } 18 | }, 19 | output: { 20 | start: 0, 21 | messages: [] 22 | } 23 | }]; 24 | -------------------------------------------------------------------------------- /packages/chameleon-linter/test/utils.test.js: -------------------------------------------------------------------------------- 1 | const utils = require('../utils'); 2 | const assert = require('chai').assert; 3 | 4 | describe('utils', function() { 5 | it('toDash', function() { 6 | let result = utils.toDash('abcDefGhi'); 7 | assert.equal(result, 'abc-def-ghi'); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/chameleon-loader/.npmignore: -------------------------------------------------------------------------------- 1 | .scripts/ 2 | test/ 3 | gulpfile.js -------------------------------------------------------------------------------- /packages/chameleon-loader/.scripts/version.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 用于钉钉推送版本信息 3 | */ 4 | module.exports = { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /packages/chameleon-loader/src/cml-compile/runtime/app.js: -------------------------------------------------------------------------------- 1 | import _cml_ from 'chameleon-runtime'; 2 | module.exports = function(){ 3 | _cml_.createApp(exports.default).getOptions(); 4 | } 5 | -------------------------------------------------------------------------------- /packages/chameleon-loader/src/cml-compile/runtime/component.js: -------------------------------------------------------------------------------- 1 | import _cml_ from 'chameleon-runtime'; 2 | 3 | module.exports = function(){ 4 | _cml_.createComponent(exports.default).getOptions(); 5 | } -------------------------------------------------------------------------------- /packages/chameleon-loader/src/cml-compile/runtime/index.js: -------------------------------------------------------------------------------- 1 | 2 | const fs = require('fs'); 3 | const path = require('path'); 4 | const _ = module.exports = {} ; 5 | _.getMiniAppRunTimeSnippet = function (platform, type) { 6 | return fs.readFileSync(path.join(__dirname, `./${type}.js`)) 7 | } 8 | _.getVueRunTimeSnippet = function (platform, type) { 9 | return fs.readFileSync(path.join(__dirname, `./web/${type}.js`)) 10 | } 11 | 12 | -------------------------------------------------------------------------------- /packages/chameleon-loader/src/cml-compile/runtime/page.js: -------------------------------------------------------------------------------- 1 | import _cml_ from 'chameleon-runtime'; 2 | 3 | module.exports = function(){ 4 | _cml_.createPage(exports.default).getOptions(); 5 | } -------------------------------------------------------------------------------- /packages/chameleon-loader/src/cml-compile/runtime/web/app.js: -------------------------------------------------------------------------------- 1 | import _cml_ from 'chameleon-runtime'; 2 | exports.default = _cml_.createApp(exports.default).getOptions() -------------------------------------------------------------------------------- /packages/chameleon-loader/src/cml-compile/runtime/web/component.js: -------------------------------------------------------------------------------- 1 | import _cml_ from 'chameleon-runtime'; 2 | 3 | exports.default = _cml_.createComponent(exports.default).getOptions() -------------------------------------------------------------------------------- /packages/chameleon-loader/src/cml-compile/runtime/web/page.js: -------------------------------------------------------------------------------- 1 | import _cml_ from 'chameleon-runtime'; 2 | 3 | exports.default = _cml_.createPage(exports.default).getOptions() -------------------------------------------------------------------------------- /packages/chameleon-loader/src/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./loader'); 2 | -------------------------------------------------------------------------------- /packages/chameleon-loader/src/parser.js: -------------------------------------------------------------------------------- 1 | const cmlUtils = require('chameleon-tool-utils'); 2 | 3 | module.exports = (content) => { 4 | let parts = cmlUtils.splitParts({content}) 5 | parts.styles = parts.style; 6 | return parts; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /packages/chameleon-loader/src/utils/normalize.js: -------------------------------------------------------------------------------- 1 | const IS_TEST = !!process.env.VUE_LOADER_TEST 2 | const fs = require('fs') 3 | const path = require('path') 4 | 5 | exports.lib = file => path.resolve(__dirname, '../', file) 6 | 7 | exports.dep = dep => { 8 | if (IS_TEST) { 9 | return dep 10 | } else if ( 11 | fs.existsSync(path.resolve(__dirname, '../../node_modules', dep)) 12 | ) { 13 | // npm 2 or npm linked 14 | return 'vue-loader/node_modules/' + dep 15 | } else { 16 | // npm 3 17 | return dep 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/chameleon-loader/src/utils/try-require.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | const cwd = process.cwd() 3 | const resolve = require('resolve') 4 | 5 | // attempts to first require a dep using projects cwd (when vue-loader is linked) 6 | // then try a normal require. 7 | module.exports = function tryRequire (dep) { 8 | let fromCwd 9 | try { 10 | fromCwd = resolve.sync(dep, { basedir: cwd }) 11 | } catch (e) {} 12 | if (fromCwd) { 13 | return require(fromCwd) 14 | } else { 15 | try { 16 | return require(dep) 17 | } catch (e) {} 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/cml-compile.test/runtime/all-properties.js: -------------------------------------------------------------------------------- 1 | function Person(name,age){ 2 | //定义自身属性 3 | this.name = name ; 4 | this.age = age; 5 | } 6 | //定义原型属性 7 | Person.prototype.jump = function(){}; 8 | Person.prototype.yell = function(){}; 9 | var person = new Person("JiM",23); 10 | //Object.defineProperty 直接给一个对象定义一个自身属性值 11 | //给person对象定义一个可以枚举的属性gender 12 | Object.defineProperty(person,'gender',{value:'male',enumerable:true}); 13 | //给person对象定义一个不可以枚举的属性weight 14 | Object.defineProperty(person,'weight',{value:'200kg',enumerable:false}); 15 | module.exports.person = person; -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/cml-compile.test/runtime/common-utils.test.js: -------------------------------------------------------------------------------- 1 | // const utils = require('../../../../lib/cml-compile/runtime/common/util.js'); 2 | // const expect = require('chai').expect; 3 | // const fs = require('fs'); 4 | // const path = require('path'); 5 | // const {person} = require('./all-properties.js'); 6 | 7 | // describe('common/utils.js',function(){ 8 | // it('test common/utils.js',function(){ 9 | // console.log(Object.keys(person)); 10 | // }) 11 | // }) 12 | //运行时的无法校验; 13 | 14 | -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/cml-compile.test/runtime/web-utils.test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-loader/test/src/cml-compile.test/runtime/web-utils.test.js -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/cml-compile.test/runtime/weex-utils.test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-loader/test/src/cml-compile.test/runtime/weex-utils.test.js -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/cml-compile.test/runtime/wx-utils.test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-loader/test/src/cml-compile.test/runtime/wx-utils.test.js -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/loader.test.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/parser.test.js: -------------------------------------------------------------------------------- 1 | const parser = require('../../src/parser.js'); 2 | const expect = require('chai').expect; 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | 6 | let source = fs.readFileSync(path.resolve(__dirname,'./parser.cml'),'utf-8'); 7 | describe('parser.js',function(){ 8 | it('test parser',function(){ 9 | let result = parser(source); 10 | expect(result.template.length).to.equal(1); 11 | expect(result.script.length).to.equal(2); 12 | expect(result.style.length).to.equal(1); 13 | }) 14 | }) 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/project/node_modules/cml-ui/scroller/scroller.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-loader/test/src/project/node_modules/cml-ui/scroller/scroller.cml -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/project/src/components/coma.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-loader/test/src/project/src/components/coma.cml -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/project/src/pages/pagea.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-loader/test/src/project/src/pages/pagea.cml -------------------------------------------------------------------------------- /packages/chameleon-loader/test/src/utils.test/try-require.test.js: -------------------------------------------------------------------------------- 1 | const try_require = require('../../../src/utils/try-require.js'); 2 | const expect = require('chai').expect; 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | 6 | describe('try_require.js',function(){ 7 | it('test try require',function(){ 8 | let result = !!try_require('@babel/parser'); 9 | expect(result).to.be.ok 10 | }) 11 | }) 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/chameleon-miniapp-target/.npmignore: -------------------------------------------------------------------------------- 1 | .scripts/ 2 | test/ 3 | gulpfile.js -------------------------------------------------------------------------------- /packages/chameleon-miniapp-target/gulpfile.js: -------------------------------------------------------------------------------- 1 | const gulp = require('gulp'); 2 | const uglify = require('gulp-uglify-es').default; 3 | 4 | gulp.task('build', function () { 5 | gulp.src('src/**/**.js') 6 | .pipe(uglify({ 7 | parse: { 8 | bare_returns: true, 9 | 10 | }, 11 | mangle: { 12 | toplevel: true 13 | }, 14 | compress: { 15 | drop_console: true, 16 | drop_debugger: true 17 | } 18 | })) 19 | .pipe(gulp.dest('dist/')); 20 | }); -------------------------------------------------------------------------------- /packages/chameleon-mixins/.npmignore: -------------------------------------------------------------------------------- 1 | .scripts -------------------------------------------------------------------------------- /packages/chameleon-mixins/wx-mixins.js: -------------------------------------------------------------------------------- 1 | const commonMixins = require('./wx-alipay-common-mixins.js'); 2 | 3 | var _ = module.exports = commonMixins.deepClone(commonMixins); 4 | commonMixins.merge(_.mixins.methods, { 5 | [_.eventEmitName]: function(eventKey, detail) { 6 | this.triggerEvent(eventKey, detail); 7 | if (this.$__checkCmlEmit__) { 8 | this.$__checkCmlEmit__(eventKey, detail); 9 | } 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /packages/chameleon-template-parse/gulpfile.js: -------------------------------------------------------------------------------- 1 | const gulp = require('gulp'); 2 | const uglify = require('gulp-uglify-es')["default"]; 3 | 4 | gulp.task('build', function () { 5 | gulp.src('src/**/**.js') 6 | .pipe(uglify({ 7 | parse: { 8 | bare_returns: true 9 | 10 | }, 11 | mangle: { 12 | toplevel: true 13 | }, 14 | compress: { 15 | drop_console: true, 16 | drop_debugger: true 17 | } 18 | })) 19 | .pipe(gulp.dest('dist/')); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/chameleon-template-parse/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |
11 |
12 | -------------------------------------------------------------------------------- /packages/chameleon-template-parse/index.js: -------------------------------------------------------------------------------- 1 | let compileTemplate = require('./src/index.js') 2 | 3 | module.exports = compileTemplate; 4 | 5 | -------------------------------------------------------------------------------- /packages/chameleon-templates/component/interface-component/index.interface: -------------------------------------------------------------------------------- 1 | 22 | -------------------------------------------------------------------------------- /packages/chameleon-templates/index.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | exports.serverTpl = path.join(__dirname, './server'); 4 | exports.blankDemoTpl = path.join(__dirname, './project'); 5 | exports.pageTpl = path.join(__dirname, './page'); 6 | exports.componentTpl = path.join(__dirname, './component'); 7 | exports.package = path.join(__dirname, './package.json'); 8 | exports.todoDemoTpl = path.join(__dirname, './todo-demo'); 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/chameleon-templates/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chameleon-templates", 3 | "version": "1.0.8", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" " 8 | }, 9 | "author": "Chameleon-Team", 10 | "license": "Apache", 11 | "mail": "ChameleonCore@didiglobal.com", 12 | "gitHead": "0cd244cfa971463102a7bef668921b38a9d42fac" 13 | } -------------------------------------------------------------------------------- /packages/chameleon-templates/project/mock/api/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = [ 3 | { 4 | method: ['get', 'post'], 5 | path: '/api/getMessage', 6 | controller: function (req, res, next) { 7 | res.json({ 8 | total: 0, 9 | message: [{ 10 | name: 'Hello chameleon!' 11 | }] 12 | }); 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /packages/chameleon-templates/project/mock/template/index.php: -------------------------------------------------------------------------------- 1 | "0", 4 | "errmsg"=> "", 5 | "pageData"=> array( 6 | "name"=>"chameleon", 7 | "age" => 10 8 | ) 9 | ); -------------------------------------------------------------------------------- /packages/chameleon-templates/project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chameleon", 3 | "version": "1.0.0", 4 | "description": "A chameleon project", 5 | "author": "", 6 | "private": true, 7 | "scripts": {}, 8 | "license": "MIT", 9 | "dependencies": { 10 | "chameleon-api": "1.0.0", 11 | "chameleon-runtime": "1.0.1", 12 | "chameleon-store": "1.0.1", 13 | "chameleon-ui-builtin": "1.0.6", 14 | "cml-ui": "1.0.3" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/chameleon-templates/project/src/assets/images/chameleon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-templates/project/src/assets/images/chameleon.png -------------------------------------------------------------------------------- /packages/chameleon-templates/project/src/router.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "history", 3 | "domain": "https://www.chameleon.com", 4 | "routes":[ 5 | { 6 | "url": "/cml/h5/index", 7 | "path": "/pages/index/index", 8 | "name": "首页", 9 | "mock": "index.php" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/chameleon-templates/project/src/store/actions.js: -------------------------------------------------------------------------------- 1 | 2 | export default { 3 | } 4 | -------------------------------------------------------------------------------- /packages/chameleon-templates/project/src/store/getters.js: -------------------------------------------------------------------------------- 1 | export default { 2 | } 3 | -------------------------------------------------------------------------------- /packages/chameleon-templates/project/src/store/index.js: -------------------------------------------------------------------------------- 1 | import actions from './actions' 2 | import getters from './getters' 3 | import state from './state' 4 | import mutations from './mutations' 5 | import createStore from "chameleon-store"; 6 | 7 | export default createStore({ 8 | actions, 9 | getters, 10 | state, 11 | mutations 12 | }) 13 | -------------------------------------------------------------------------------- /packages/chameleon-templates/project/src/store/mutations.js: -------------------------------------------------------------------------------- 1 | 2 | export default { 3 | } 4 | -------------------------------------------------------------------------------- /packages/chameleon-templates/project/src/store/state.js: -------------------------------------------------------------------------------- 1 | 2 | const state = { 3 | } 4 | 5 | export default state 6 | -------------------------------------------------------------------------------- /packages/chameleon-templates/server/fisdata/bookmark.js: -------------------------------------------------------------------------------- 1 | javascript: void 2 | function() { 3 | var d = new Date(); 4 | d.setFullYear(d.getFullYear() + 1); 5 | document.cookie = 'FIS_DEBUG_DATA=4f10e208f47bfb4d35a5e6f115a6df1a;path=/;expires=' + d.toGMTString() + ''; 6 | location.reload(); 7 | }(); -------------------------------------------------------------------------------- /packages/chameleon-templates/server/fisdata/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies" : { 3 | "smarty" : "*" 4 | } 5 | } -------------------------------------------------------------------------------- /packages/chameleon-templates/server/fisdata/plugin/FISJSONData.class.php: -------------------------------------------------------------------------------- 1 | datatype = 'json'; 6 | } 7 | 8 | public function getData($tmpl) { 9 | $file = $this->getFile($tmpl); 10 | $ret = array(); 11 | if (is_file($file)) { 12 | $ret = json_decode(file_get_contents($file), true); 13 | if ($ret === null) { 14 | $ret = array(); 15 | } 16 | } 17 | return $ret; 18 | } 19 | } -------------------------------------------------------------------------------- /packages/chameleon-templates/server/fisdata/plugin/FISPHPData.class.php: -------------------------------------------------------------------------------- 1 | datatype = 'php'; 6 | } 7 | 8 | public function getData($tmpl) { 9 | $file = $this->getFile($tmpl); 10 | $ret = array(); 11 | if (is_file($file)) { 12 | require($file); 13 | 14 | $ret = $chameleon; 15 | } 16 | return $ret; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/chameleon-templates/server/fisdata/plugin/gen_plugins.php.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | d=`pwd` 4 | 5 | cd $d && ls -1 | grep 'class' | awk 'BEGIN{content=" "plugins.php" }' -------------------------------------------------------------------------------- /packages/chameleon-templates/server/fisdata/plugin/plugins.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: noprint
14 | * Purpose: return an empty string 15 | * 16 | * @author Uwe Tews 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | function smarty_modifiercompiler_noprint($params, $compiler) 21 | { 22 | return "''"; 23 | } 24 | 25 | ?> -------------------------------------------------------------------------------- /packages/chameleon-templates/server/smarty/plugins/variablefilter.htmlspecialchars.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/mock/api/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = [ 3 | { 4 | method: ['get', 'post'], 5 | path: '/api/getMessage', 6 | controller: function (req, res, next) { 7 | res.json({ 8 | total: 0, 9 | message: [{ 10 | name: 'Hello chameleon!' 11 | }] 12 | }); 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/mock/template/index.php: -------------------------------------------------------------------------------- 1 | "0", 4 | "errmsg"=> "", 5 | "pageData"=> array( 6 | "name"=>"chameleon", 7 | "age" => 10 8 | ) 9 | ); -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chameleon", 3 | "version": "1.0.0", 4 | "description": "A chameleon project", 5 | "author": "", 6 | "private": true, 7 | "scripts": {}, 8 | "license": "MIT", 9 | "dependencies": { 10 | "chameleon-api": "0.5.4", 11 | "chameleon-runtime": "1.0.0", 12 | "chameleon-store": "1.0.0", 13 | "chameleon-ui-builtin": "1.0.0", 14 | "cml-ui": "1.0.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/assets/images/chameleon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-templates/todo-demo/src/assets/images/chameleon.png -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/assets/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-templates/todo-demo/src/assets/images/close.png -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/router.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "history", 3 | "domain": "https://api.chameleon.com", 4 | "routes":[ 5 | { 6 | "url": "/cml/h5/index", 7 | "path": "/pages/index/index", 8 | "name": "首页", 9 | "mock": "index.php" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/action-types.js: -------------------------------------------------------------------------------- 1 | 2 | import {checkDuplicate} from './utils'; 3 | import * as index from './index/action-types'; 4 | 5 | let list = [index]; 6 | checkDuplicate(list); 7 | 8 | export default { 9 | ...index 10 | } 11 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/actions.js: -------------------------------------------------------------------------------- 1 | import index from './index/actions' 2 | 3 | export default { 4 | ...index 5 | } 6 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/getter-types.js: -------------------------------------------------------------------------------- 1 | import {checkDuplicate} from './utils'; 2 | import * as index from './index/getter-types'; 3 | 4 | let list = [index]; 5 | checkDuplicate(list); 6 | 7 | export default { 8 | ...index 9 | } 10 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/getters.js: -------------------------------------------------------------------------------- 1 | import index from './index/getters' 2 | 3 | export default { 4 | ...index 5 | } 6 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/index.js: -------------------------------------------------------------------------------- 1 | import actions from './actions' 2 | import getters from './getters' 3 | import state from './state' 4 | import mutations from './mutations' 5 | import createStore from "chameleon-store"; 6 | 7 | export default createStore({ 8 | actions, 9 | getters, 10 | state, 11 | mutations 12 | }) 13 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/index/action-types.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | //整个替换 4 | export const INDEX_CHANGE_TODOS = 'INDEX_CHANGE_TODOS' 5 | //添加todos 6 | export const INDEX_ADD_TODOS = 'INDEX_ADD_TODOS' 7 | //删除某行 8 | export const INDEX_DELETE_TODOS = 'INDEX_DELETE_TODOS' 9 | //置顶某行 10 | export const INDEX_TOP_TODOS = 'INDEX_TOP_TODOS' 11 | //更改状态 12 | export const INDEX_CHANGE_TODOS_STATUS = 'INDEX_CHANGE_TODOS_STATUS' 13 | //清楚已完成项 14 | export const INDEX_CHANGE_TODOS_CLEAR_COMPLETED = 'INDEX_CHANGE_TODOS_CLEAR_COMPLETED' 15 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/index/getter-types.js: -------------------------------------------------------------------------------- 1 | 2 | export const INDEX_DESC_TODOS = 'INDEX_DESC_TODOS' 3 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/index/getters.js: -------------------------------------------------------------------------------- 1 | import * as types from './getter-types' 2 | 3 | export default { 4 | [types.INDEX_DESC_TODOS]: function(state, getters) { 5 | return state.index.todos; 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/index/mutation-types.js: -------------------------------------------------------------------------------- 1 | 2 | export const INDEX_CHANGE_TODOS = 'INDEX_CHANGE_TODOS' 3 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/index/mutations.js: -------------------------------------------------------------------------------- 1 | import * as types from './mutation-types' 2 | 3 | const mutations = { 4 | [types.INDEX_CHANGE_TODOS](state, todos) { 5 | state.index.todos = todos; 6 | } 7 | } 8 | 9 | export default mutations 10 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/index/state.js: -------------------------------------------------------------------------------- 1 | const state = { 2 | todos: [] 3 | } 4 | 5 | export default state 6 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/mutation-types.js: -------------------------------------------------------------------------------- 1 | import {checkDuplicate} from './utils'; 2 | import * as index from './index/mutation-types'; 3 | 4 | let list = [index]; 5 | checkDuplicate(list); 6 | 7 | export default { 8 | ...index 9 | } 10 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/mutations.js: -------------------------------------------------------------------------------- 1 | import index from './index/mutations' 2 | 3 | export default { 4 | ...index 5 | } 6 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/state.js: -------------------------------------------------------------------------------- 1 | import index from './index/state'; 2 | 3 | const state = { 4 | index 5 | } 6 | 7 | export default state 8 | -------------------------------------------------------------------------------- /packages/chameleon-templates/todo-demo/src/store/utils.js: -------------------------------------------------------------------------------- 1 | 2 | export function checkDuplicate(list) { 3 | let tempArray = []; 4 | for(let i=0;i -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/chameleon-ui-builtin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "copy-npm", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "components", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "cml": { 12 | "wx": { 13 | "pages": [ 14 | "/pages/index/index" 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-pages/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "copy-npm", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "cml": { 12 | "pages": "/pages/index/index" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-pages/src/router.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "history", 3 | "domain": "https://www.chameleon.com", 4 | "routes":[ 5 | { 6 | "url": "/cml/h5/index", 7 | "path": "/pages/page1/page1", 8 | "name": "首页", 9 | "mock": "index.php" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/mock/api/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = [ 3 | { 4 | method: ['get', 'post'], 5 | path: '/api/getMessage', 6 | controller: function (req, res, next) { 7 | res.json({ 8 | total: 0, 9 | message: [{ 10 | name: 'Hello chameleon!' 11 | }] 12 | }); 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/mock/template/index.php: -------------------------------------------------------------------------------- 1 | "0", 4 | "errmsg"=> "", 5 | "pageData"=> array( 6 | "name"=>"chameleon", 7 | "age" => 10 8 | ) 9 | ); -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chameleon", 3 | "version": "1.0.0", 4 | "description": "A chameleon project", 5 | "author": "", 6 | "private": true, 7 | "scripts": {}, 8 | "license": "MIT", 9 | "dependencies": { 10 | "chameleon-api": "0.4.3", 11 | "chameleon-bridge": "0.1.2", 12 | "chameleon-runtime": "0.1.4", 13 | "chameleon-store": "0.0.3", 14 | "chameleon-ui-builtin": "^0.2.0", 15 | "cml-ui": "0.1.7" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/src/assets/images/chameleon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/src/assets/images/chameleon.png -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/src/router.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "history", 3 | "domain": "https://www.chameleon.com", 4 | "routes":[ 5 | { 6 | "url": "/cml/h5/index", 7 | "path": "/pages/index/index", 8 | "name": "首页", 9 | "mock": "index.php" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/src/store/actions.js: -------------------------------------------------------------------------------- 1 | 2 | export default { 3 | } 4 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/src/store/getters.js: -------------------------------------------------------------------------------- 1 | export default { 2 | } 3 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/src/store/index.js: -------------------------------------------------------------------------------- 1 | import actions from './actions' 2 | import getters from './getters' 3 | import state from './state' 4 | import mutations from './mutations' 5 | import createStore from "chameleon-store"; 6 | 7 | export default createStore({ 8 | actions, 9 | getters, 10 | state, 11 | mutations 12 | }) 13 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/src/store/mutations.js: -------------------------------------------------------------------------------- 1 | 2 | export default { 3 | } 4 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/cml-subproject/src/store/state.js: -------------------------------------------------------------------------------- 1 | 2 | const state = { 3 | } 4 | 5 | export default state 6 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/copy-npm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "copy-npm", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "cml": { 12 | "wx": { 13 | "pages": [ 14 | "/pages/index/index" 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/npm-components/components/button/button.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/npm-components/components/button/button.cml -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/npm-components/components/button/button.interface: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/npm-components/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "copy-npm", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "components", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "cml": { 12 | "wx": { 13 | "pages": [ 14 | "/pages/index/index" 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/vant-weapp/test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/vant-weapp/test.js -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/vant-weapp/test.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/vant-weapp/test.wxml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/vant-weapp/test.wxss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool-utils/test/testlib/demo-project/node_modules/vant-weapp/test.wxss -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fse", 3 | "version": "1.0.0", 4 | "description": "A chameleon project", 5 | "author": "", 6 | "private": true, 7 | "scripts": {}, 8 | "license": "MIT", 9 | "dependencies": { 10 | "chameleon-runtime": "~1.1.0", 11 | "chameleon-store": "~1.0.0", 12 | "cml-ui": "~1.0.0", 13 | "chameleon-ui-builtin": "~1.0.0", 14 | "chameleon-api": "~0.1.0", 15 | "chameleon-bridge": "~0.1.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/src/components/com2/com2.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/src/components/com2/com2.web.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool-utils/test/testlib/demo-project/src/components/com2/com2.web.cml -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/src/components/com2/com2.wx.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool-utils/test/testlib/demo-project/src/components/com2/com2.wx.cml -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/src/components/com3/com3.interface: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool-utils/test/testlib/demo-project/src/components/com3/com3.interface -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/src/pages/pageb/pageb.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool-utils/test/testlib/demo-project/src/pages/pageb/pageb.cml -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/demo-project/src/router.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "history", 3 | "domain": "https://www.chameleon.com", 4 | "routes":[ 5 | { 6 | "url": "/cml/h5/index", 7 | "path": "/pages/pagea/pagea", 8 | "name": "首页", 9 | "mock": "index.php" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/wx/wx.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "unit-test" 3 | } -------------------------------------------------------------------------------- /packages/chameleon-tool-utils/test/testlib/wx/wx.wxml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool-utils/test/testlib/wx/wx.wxml -------------------------------------------------------------------------------- /packages/chameleon-tool/.npmignore: -------------------------------------------------------------------------------- 1 | .scripts 2 | test 3 | package-lock.json -------------------------------------------------------------------------------- /packages/chameleon-tool/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "8" 4 | script: 5 | - npm run cover 6 | after_script: "cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js" 7 | -------------------------------------------------------------------------------- /packages/chameleon-tool/chameleon.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | //--inspect-brk 3 | 4 | require('./lib/index.js'); 5 | -------------------------------------------------------------------------------- /packages/chameleon-tool/commanders/extPlatform.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | module.exports = function({type, media}) { 4 | const utils = require('./utils.js'); 5 | cml.media = media; 6 | cml.log.startBuilding(); 7 | utils.startReleaseOne(media, type); 8 | } -------------------------------------------------------------------------------- /packages/chameleon-tool/commanders/init/platform.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "h5": "web", 4 | "weex": "weex", 5 | "微信小程序": "wx", 6 | "支付宝小程序": "alipay", 7 | "百度小程序": "baidu", 8 | "qq小程序": "qq" 9 | } -------------------------------------------------------------------------------- /packages/chameleon-tool/commanders/web/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /packages/chameleon-tool/commanders/web/liveload-dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-liveload-middleware/client') 4 | 5 | -------------------------------------------------------------------------------- /packages/chameleon-tool/commanders/web/php_cgi_middleware.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var phpcgi = require('node-phpcgi'); 4 | 5 | module.exports = function(root) { 6 | return phpcgi({ 7 | documentRoot: root, 8 | entryPoint: '/index.php', 9 | includePath: '/', 10 | handler: 'php-cgi' 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/cml-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | 3 | 4 | module.exports = function ({type, hot, disableExtract, media, mode}) { 5 | let extract = hot !== true && disableExtract !== true; 6 | return { 7 | loaders: utils.cssLoaders({ 8 | sourceMap: false, 9 | extract, 10 | type, 11 | media, 12 | mode 13 | }) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/default/app.cml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/default/entry.js: -------------------------------------------------------------------------------- 1 | import runtime from 'chameleon-runtime'; 2 | import app from '$PROJECT/src/app/app.cml'; 3 | import store from '$PROJECT/src/store/index.js'; 4 | import router from '$ROUTER'; 5 | import routerConfig from '$PROJECT/src/router.config.json'; 6 | 7 | runtime.bootstrap({app, store, router, routerConfig}); 8 | 9 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/default/html_entry.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <% if (htmlWebpackPlugin.options.console) { %> 9 | 10 | <% } %> 11 | 12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/default/router.js: -------------------------------------------------------------------------------- 1 | 2 | /*global Vue*/ 3 | import VueRouter from 'vue-router'; 4 | Vue.use(VueRouter); 5 | 6 | // 根据配置生成的路由options 7 | const routerOptions = '$ROUTER_OPTIONS'; 8 | 9 | routerOptions.mode = process.env.platform === 'web' ? routerOptions.mode : 'abstract'; 10 | 11 | const Router = new VueRouter(routerOptions) 12 | export default Router 13 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/default/weex_liveload_entry.js: -------------------------------------------------------------------------------- 1 | 2 | import bridge from 'chameleon-bridge'; 3 | 4 | let wsAddr = `ws://${process.env.serverIp}:${process.env.liveloadPort}` 5 | 6 | let socketInstance = bridge.initSocket({url: wsAddr}); 7 | 8 | socketInstance.onopen(function (e) { 9 | }) 10 | 11 | socketInstance.onmessage(function (e) { 12 | if (e.data === 'weex_refresh') { 13 | bridge.reload() 14 | } 15 | }) 16 | socketInstance.onerror(function (e) { 17 | 18 | }) 19 | socketInstance.onclose(function (e) { 20 | 21 | }) 22 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/entryLoader.js: -------------------------------------------------------------------------------- 1 | /* 2 | 将 import router from '$ROUTER 转化为 3 | import router from '$ROUTER?query=0'; //'$ROUTER?query=1'之类的 4 | 转化比较简单,可以用正则,该文件源文件在 configs/default/entry.js 中 5 | */ 6 | 7 | module.exports = function(content) { 8 | this.cacheable(false); 9 | const resourceQuery = this.resourceQuery 10 | return content.replace('$ROUTER', `$ROUTER${resourceQuery}`) 11 | } 12 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/getMiniAppDevConfig.js: -------------------------------------------------------------------------------- 1 | var getMiniAppCommonConfig = require('./getMiniAppCommonConfig.js'); 2 | var merge = require('webpack-merge') 3 | 4 | module.exports = function (options) { 5 | return merge(getMiniAppCommonConfig(options), {}) 6 | } 7 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/getWeexDevConfig.js: -------------------------------------------------------------------------------- 1 | var getWeexCommonConfig = require('./getWeexCommonConfig.js'); 2 | var merge = require('webpack-merge'); 3 | const config = require('./config.js'); 4 | const webpack = require('webpack'); 5 | const utils = require('./utils'); 6 | 7 | module.exports = function (options) { 8 | return merge(getWeexCommonConfig(options), { 9 | plugins: [ 10 | new webpack.DefinePlugin({ 11 | 'process.env.serverIp': JSON.stringify(config.ip), 12 | 'process.env.liveloadPort': JSON.stringify(utils.getFreePort().weexLiveLoadPort) 13 | }) 14 | ] 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/mvvm/originSourceLoader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * js 模块获取节点源代码,在interface-loader处理后 babel-loader前 3 | */ 4 | module.exports = function (output) { 5 | this._module._cmlOriginSource = output; 6 | return output; 7 | } 8 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/postcss/alipay/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | let result = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "postcss-import": {} 7 | } 8 | } 9 | if(cml.config.get().cmss.enableAutoPrefix === true) { 10 | result.plugins.autoprefixer = cml.config.get().cmss.autoprefixOptions 11 | } 12 | 13 | module.exports = result; 14 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/postcss/baidu/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | let result = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "postcss-import": {} 7 | } 8 | } 9 | if(cml.config.get().cmss.enableAutoPrefix === true) { 10 | result.plugins.autoprefixer = cml.config.get().cmss.autoprefixOptions 11 | } 12 | 13 | module.exports = result; 14 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/postcss/export/.postcssrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "plugins": [ 3 | require('../../component_export/postcssPlugin.js') 4 | ] 5 | } -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/postcss/extend/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | module.exports = { 3 | "plugins": { 4 | // to edit target browsers: use "browserslist" field in package.json 5 | "postcss-import": {}, 6 | } 7 | } -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/postcss/qq/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | let result = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "postcss-import": {} 7 | } 8 | } 9 | if(cml.config.get().cmss.enableAutoPrefix === true) { 10 | result.plugins.autoprefixer = cml.config.get().cmss.autoprefixOptions 11 | } 12 | 13 | module.exports = result; 14 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/postcss/tt/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | let result = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "postcss-import": {} 7 | } 8 | } 9 | if(cml.config.get().cmss.enableAutoPrefix === true) { 10 | result.plugins.autoprefixer = cml.config.get().cmss.autoprefixOptions 11 | } 12 | 13 | module.exports = result; 14 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/postcss/web/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | let result = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "postcss-import": {} 7 | } 8 | } 9 | if(cml.config.get().cmss.enableAutoPrefix === true) { 10 | result.plugins.autoprefixer = cml.config.get().cmss.autoprefixOptions 11 | } 12 | 13 | module.exports = result; 14 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/postcss/weex/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | module.exports = { 3 | "plugins": { 4 | // to edit target browsers: use "browserslist" field in package.json 5 | "postcss-import": {} 6 | } 7 | } -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/postcss/wx/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | let result = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "postcss-import": {} 7 | } 8 | } 9 | if(cml.config.get().cmss.enableAutoPrefix === true) { 10 | result.plugins.autoprefixer = cml.config.get().cmss.autoprefixOptions 11 | } 12 | 13 | module.exports = result; 14 | -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-alipay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-alipay.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-baidu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-baidu.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-chameleon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-chameleon.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-forbidden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-forbidden.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-h5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-h5.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-logo.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-qq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-qq.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-right.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-tt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-tt.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-weex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-weex.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/cml-weixin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/cml-weixin.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/preview-assets/phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/chameleon-tool/configs/preview-assets/phone.png -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/web_global.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0px; 3 | padding: 0px; 4 | } 5 | 6 | /* 只允许进行滚动和持续缩放操作 */ 7 | a, 8 | button, 9 | [role="button"], 10 | input, 11 | label, 12 | select, 13 | textarea { 14 | touch-action: manipulation; 15 | } 16 | 17 | p, 18 | ol, 19 | ul, 20 | dl, 21 | figure { 22 | margin: 0; 23 | padding: 0; 24 | } 25 | 26 | li { 27 | list-style: none; 28 | } -------------------------------------------------------------------------------- /packages/chameleon-tool/configs/web_global.js: -------------------------------------------------------------------------------- 1 | 2 | import Vue from 'vue'; 3 | require('./web_global.css'); 4 | window.Vue = Vue; 5 | window.CML = {}; 6 | window.CML.Vue = Vue; 7 | 8 | -------------------------------------------------------------------------------- /packages/chameleon-tool/test/lib/cli.test.js: -------------------------------------------------------------------------------- 1 | process.argv = ['node', 'chameleon.js']; 2 | 3 | require('../../lib/index.js'); 4 | 5 | describe('log.js', function () { 6 | it('it should console debug', function () { 7 | let cli = require('../../lib/cli.js'); 8 | cli.run(); 9 | }) 10 | 11 | }) 12 | -------------------------------------------------------------------------------- /packages/chameleon-vue-precompiler/.npmignore: -------------------------------------------------------------------------------- 1 | .scripts 2 | node_modules/ -------------------------------------------------------------------------------- /packages/chameleon-vue-precompiler/lib/index.js: -------------------------------------------------------------------------------- 1 | 2 | const Precompiler = require('./precompiler') 3 | 4 | /** 5 | * 6 | * @param {Object} config 7 | */ 8 | module.exports = function getPrecompiler (config) { 9 | const precompiler = new Precompiler(config) 10 | return precompiler.compile.bind(precompiler) 11 | } 12 | -------------------------------------------------------------------------------- /packages/chameleon-vue-precompiler/lib/precompiler/components/div.js: -------------------------------------------------------------------------------- 1 | exports.processDiv = function ( 2 | el, 3 | attrsMap, 4 | attrsList, 5 | attrs, 6 | staticClass 7 | ) { 8 | // const finalClass = staticClass + ' cml-flx cml-view' 9 | el.staticClass = `"${staticClass}"` 10 | attrs.push({ 11 | name: `cml-type`, 12 | value: '"div"' 13 | }) 14 | el.plain = false 15 | } 16 | -------------------------------------------------------------------------------- /packages/chameleon-vue-precompiler/lib/precompiler/components/index.js: -------------------------------------------------------------------------------- 1 | const div = require('./div') 2 | const span = require('./span') 3 | 4 | const cmpMaps = { div, span } 5 | 6 | module.exports = { 7 | div: div.processDiv, 8 | span: span.processSpan, 9 | // get ast compiler for binding styles. 10 | getCompiler: function (tag) { 11 | const cmp = cmpMaps[tag] 12 | const compile = cmp && cmp.compile 13 | return compile ? { compile } : undefined 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/chameleon-vue-precompiler/lib/precompiler/components/span.js: -------------------------------------------------------------------------------- 1 | exports.processSpan = function ( 2 | el, 3 | attrsMap, 4 | attrsList, 5 | attrs, 6 | staticClass 7 | ) { 8 | // const finalClass = staticClass + ' cml-bk cml-text' 9 | el.staticClass = `"${staticClass}"` 10 | attrs.push({ 11 | name: `cml-type`, 12 | value: '"span"' 13 | }) 14 | delete el.ns 15 | el.plain = false 16 | } -------------------------------------------------------------------------------- /packages/chameleon-vue-precompiler/lib/precompiler/hooks/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'events': require('./events'), 3 | // 'style': require('./style'), 4 | // 'style-binding': require('./style-binding') 5 | } 6 | -------------------------------------------------------------------------------- /packages/chameleon-vue-precompiler/lib/precompiler/util/ast.js: -------------------------------------------------------------------------------- 1 | const esprima = require('esprima') 2 | 3 | exports.parseAst = (function () { 4 | const _cached = {} 5 | return function (val) { 6 | let statement = 'a = ' 7 | if (typeof val === 'object') { 8 | statement += `${JSON.stringify(val)}` 9 | } 10 | else { 11 | statement += val 12 | } 13 | const cached = _cached[statement] 14 | if (cached) { 15 | return cached 16 | } 17 | const ast = esprima.parse(statement) 18 | .body[0].expression.right 19 | _cached[statement] = ast 20 | return ast 21 | } 22 | })() 23 | -------------------------------------------------------------------------------- /packages/chameleon-vue-precompiler/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chameleon-vue-precompiler", 3 | "version": "1.0.8-alpah.1", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "esprima": { 8 | "version": "4.0.1", 9 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", 10 | "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/chameleon-vue-precompiler/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chameleon-vue-precompiler", 3 | "version": "1.0.8", 4 | "description": "为chameleon提供 vue-loader 的模板预编译处理能力", 5 | "author": "Chameleon-Team", 6 | "scripts": {}, 7 | "license": "Apache", 8 | "main": "lib/index.js", 9 | "mail": "ChameleonCore@didiglobal.com", 10 | "dependencies": { 11 | "esprima": "^4.0.1" 12 | }, 13 | "gitHead": "5ddcde4330774710f7646559446e008f7785ce00" 14 | } -------------------------------------------------------------------------------- /packages/chameleon-webpack-plugin/lib/utils.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | module.exports.chameleonHandle = function (content, cliName) { 5 | // 首先是把chameleon-cli前面的删除,然后就是loader中的 6 | let reg = new RegExp(`[\\.\\/]+?([^\\"\\'\\/\\?\\!\\&]+\/)*?${cliName}`, 'g') 7 | content = content.replace(reg, function(m, s1) { 8 | return `${cliName}` 9 | }) 10 | return content; 11 | } 12 | -------------------------------------------------------------------------------- /packages/chameleon-weex-vue-loader/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/loader') 2 | 3 | -------------------------------------------------------------------------------- /packages/chameleon-weex-vue-loader/lib/gen-id.js: -------------------------------------------------------------------------------- 1 | // utility for generating a uid for each component file 2 | // used in scoped CSS rewriting 3 | var hash = require('hash-sum') 4 | var cache = Object.create(null) 5 | 6 | module.exports = function genId (file) { 7 | return cache[file] || (cache[file] = hash(file)) 8 | } 9 | -------------------------------------------------------------------------------- /packages/chameleon-weex-vue-loader/lib/script-loader.js: -------------------------------------------------------------------------------- 1 | var REQUIRE_REG = /require\((["'])@weex\-module\/([^\)\1]+)\1\)/g 2 | 3 | module.exports = function (content) { 4 | this.cacheable && this.cacheable() 5 | return content.replace(REQUIRE_REG, '__weex_require_module__($1$2$1)') 6 | } 7 | -------------------------------------------------------------------------------- /packages/chameleon-weex-vue-loader/lib/selector.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var parse = require('./parser') 3 | var loaderUtils = require('loader-utils') 4 | 5 | module.exports = function (content) { 6 | this.cacheable() 7 | 8 | var query = loaderUtils.getOptions(this) || {} 9 | var filename = path.basename(this.resourcePath) 10 | var parts = parse(content, filename, this.sourceMap) 11 | var part = parts[query.type] 12 | if (Array.isArray(part)) { 13 | part = part[query.index] 14 | } 15 | 16 | this.callback(null, part.content, part.map) 17 | } 18 | -------------------------------------------------------------------------------- /packages/cml-component-parser/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/cml-component-parser/.gitignore -------------------------------------------------------------------------------- /packages/cml-extract-css-webpack-plugin/README.md: -------------------------------------------------------------------------------- 1 | - 基于 extract-text-webpack-plugin@3.0.2 改造 2 | - 修复提取vue和cml文件css的组合顺序。 -------------------------------------------------------------------------------- /packages/cml-extract-css-webpack-plugin/dist/cjs.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('./index').default; -------------------------------------------------------------------------------- /packages/cml-extract-css-webpack-plugin/dist/lib/OrderUndefinedError.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | function OrderUndefinedError(module) { 7 | Error.call(this); 8 | Error.captureStackTrace(this, OrderUndefinedError); 9 | this.name = 'OrderUndefinedError'; 10 | this.message = 'Order in extracted chunk undefined'; 11 | this.module = module; 12 | } 13 | exports.default = OrderUndefinedError; 14 | 15 | 16 | OrderUndefinedError.prototype = Object.create(Error.prototype); -------------------------------------------------------------------------------- /packages/cml-extract-css-webpack-plugin/schema/loader.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "object", 3 | "additionalProperties": false, 4 | "properties": { 5 | "allChunks": { 6 | "type": "boolean" 7 | }, 8 | "disable": { 9 | "type": "boolean" 10 | }, 11 | "omit": { 12 | "type": "boolean" 13 | }, 14 | "remove": { 15 | "type": "boolean" 16 | }, 17 | "fallback": { 18 | "type": ["string", "array", "object"] 19 | }, 20 | "filename": { 21 | "type": "string" 22 | }, 23 | "use": { 24 | "type": ["string", "array", "object"] 25 | }, 26 | "publicPath": { 27 | "type": "string" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/cml-extract-css-webpack-plugin/test/index.js: -------------------------------------------------------------------------------- 1 | const {getAllFileSort} = require('../dist/helper'); 2 | const map = { 3 | 'a': ['b','c','d'], 4 | 'b': ['a','e','f'] 5 | } 6 | 7 | let result = getAllFileSort(map); 8 | // [ 'e', 'f', 'b', 'c', 'd', 'a' ] 9 | console.log(result); -------------------------------------------------------------------------------- /packages/cml-htmllinter/AUTHORS: -------------------------------------------------------------------------------- 1 | Michael Coleman (http://github.com/coalman) 2 | Andrew Messier (http://github.com/messman) 3 | Marshall Lochbaum (http://github.com/mlochbaum) 4 | Roman Myers (http://github.com/romnempire) -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/hook/index.js: -------------------------------------------------------------------------------- 1 | var bulk = require('bulk-require'); 2 | var lodash = require('lodash'); 3 | 4 | // import all the js files in the directory 5 | var hookExports = bulk(__dirname, '!(index).js'); 6 | var hook = {}; 7 | 8 | // mixin all the functions from the exports into hook 9 | lodash.values(hookExports).forEach(function (u) { 10 | hook[u.name] = u; 11 | }); 12 | 13 | // export hook 14 | module.exports = hook; 15 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/issue.js: -------------------------------------------------------------------------------- 1 | function Issue(code, pos, data) { 2 | this.line = pos[0]; 3 | this.column = pos[1]; 4 | this.code = code; 5 | this.data = data || {}; 6 | } 7 | module.exports = Issue; 8 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/knife/index.js: -------------------------------------------------------------------------------- 1 | var bulk = require('bulk-require'); 2 | var lodash = require('lodash'); 3 | 4 | // import all the js files in the directory 5 | var utilExports = bulk(__dirname, '!(index).js'); 6 | var utils = {}; 7 | 8 | // mixin all the functions from the exports into utils 9 | lodash.values(utilExports).forEach(function (u) { 10 | lodash.mixin(utils, u); 11 | }); 12 | 13 | // export utils 14 | module.exports = utils; 15 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/knife/is_cml_directives.js: -------------------------------------------------------------------------------- 1 | const isCmlDirectiveRegex = /^c-(?!bind)/; 2 | 3 | module.exports.isCmlDirective = function(attrName) { 4 | return isCmlDirectiveRegex.test(attrName); 5 | } 6 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/knife/is_common_attrs.js: -------------------------------------------------------------------------------- 1 | const isCommonAttrRegex = /^(id|class|style|ref|(data-.+))$/; 2 | /** 3 | * Using a regex to recognize whether an attribute is a common attribute that all tags have. 4 | * @param {String} attrName the name of an attribute 5 | * @return {Boolean} 6 | */ 7 | module.exports.isCommonAttr = function(attrName) { 8 | return isCommonAttrRegex.test(attrName); 9 | } 10 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/knife/is_common_events.js: -------------------------------------------------------------------------------- 1 | const commonEvents = ['tap', 'click', 'touchstart', 'touchmove', 'touchend']; 2 | 3 | module.exports.isCommonEvent = function(eventName) { 4 | return ~commonEvents.indexOf(eventName); 5 | } 6 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/knife/is_origin_tag.js: -------------------------------------------------------------------------------- 1 | const originReg = /^origin-([^-]+)/; 2 | 3 | module.exports.isOriginTag = function(name) { 4 | return originReg.test(name); 5 | } 6 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/knife/match_filter.js: -------------------------------------------------------------------------------- 1 | module.exports.matchFilter = function (data, rule) { 2 | if (!rule.filter) { 3 | return true; 4 | } 5 | 6 | return rule.filter.indexOf(data.toLowerCase()) > -1; 7 | }; 8 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/presets/accessibility.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'fig-req-figcaption': true, 3 | 'focusable-tabindex-style': true, 4 | 'input-radio-req-name': true, 5 | 'input-req-label': true, 6 | 'page-title': true, 7 | 'table-req-caption': true, 8 | 'table-req-header': true, 9 | 'tag-name-match':true 10 | }; 11 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/presets/global.js: -------------------------------------------------------------------------------- 1 | var proc = require('../process_option'); 2 | 3 | module.exports = { 4 | 'template-lang': { 5 | process: proc.str 6 | }, 7 | 'platform-lang': { 8 | process: proc.str 9 | }, 10 | 'origin-tag-list': { 11 | process: proc.arrayOfStr 12 | } 13 | } -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/presets/index.js: -------------------------------------------------------------------------------- 1 | var lodash = require('lodash'); 2 | var bulk = require('bulk-require'); 3 | 4 | var presets = bulk(__dirname, '!(index).js'); 5 | presets.none = lodash.mapValues(presets.default, function(){return false;}); 6 | module.exports.presets = presets; 7 | 8 | module.exports.flattenOpts = function (optList) { 9 | var options = {}; 10 | 11 | optList.forEach(function (opt) { 12 | if (lodash.isString(opt)) { 13 | opt = presets[opt]; 14 | } 15 | 16 | lodash.assign(options, opt); 17 | }); 18 | 19 | return options; 20 | }; 21 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/presets/validate.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'doctype-first': true, 3 | 'doctype-html5': true, 4 | 'attr-no-dup': true, 5 | 'id-no-dup': true, 6 | 'img-req-alt': 'allownull', 7 | 'img-req-src': true, 8 | 'label-req-for': 'strict', 9 | 'title-no-dup': true, 10 | 'tag-close': true, 11 | 'html-valid-content-model': true, 12 | 'head-valid-content-model': true, 13 | 'attr-validate': true 14 | }; 15 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/attr-no-dup.js: -------------------------------------------------------------------------------- 1 | var Issue = require('../issue'); 2 | 3 | module.exports = { 4 | name: 'attr-no-dup', 5 | on: ['tag'], 6 | desc: 'If set, the same attribute name cannot be repeated within a single tag.' 7 | }; 8 | 9 | module.exports.lint = function (element, opts) { 10 | return element.dupes.map(function (n) { 11 | var a = element.attribs[n]; 12 | 13 | return new Issue('E003', a.nameLineCol, { attribute: n }); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/attr-validate.js: -------------------------------------------------------------------------------- 1 | var Issue = require('../issue'); 2 | 3 | module.exports = { 4 | name: 'attr-validate', 5 | on: ['tag'], 6 | desc: 'If set, attributes in a tag must be well-formed.' 7 | }; 8 | 9 | module.exports.lint = function (ele, opts) { 10 | var attrRegex = /^\s*([^ "'>=\^]+(\s*=\s*(("[^"]*")|('[^']*')|([^ \t\n"']+)))?\s+)*$/, 11 | open = ele.open.slice(ele.name.length).replace(/\/$/,''); 12 | return attrRegex.test(open + ' ') ? [] : new Issue('E049', ele.openLineCol); 13 | }; 14 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/head-req-title.js: -------------------------------------------------------------------------------- 1 | var Issue = require('../issue'); 2 | 3 | module.exports = { 4 | name: 'head-req-title', 5 | on: ['title'], 6 | desc: 'If set, any `head` tag in the page must contain a non-empty `title` tag.' 7 | }; 8 | 9 | module.exports.lint = function (titles, opts) { 10 | return titles.some(function(t) { return t.children.length > 0; }) 11 | ? [] 12 | : new Issue('E027', titles.head.openLineCol); 13 | } 14 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/img-req-src.js: -------------------------------------------------------------------------------- 1 | var knife = require('../knife'), 2 | Issue = require('../issue'); 3 | 4 | module.exports = { 5 | name: 'img-req-src', 6 | on: ['tag'], 7 | filter: ['img'], 8 | desc: 'If set, a source must be given for each `img` tag.' 9 | }; 10 | 11 | module.exports.lint = function (element, opts) { 12 | return knife.hasNonEmptyAttr(element, 'src') 13 | ? [] 14 | : new Issue('E014', element.openLineCol); 15 | }; 16 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/index.js: -------------------------------------------------------------------------------- 1 | // Export an array of all rules. 2 | 3 | var bulk = require('bulk-require'); 4 | 5 | // All modules in this directory excluding this file 6 | var rulesExport = bulk(__dirname, '!(index).js'); 7 | 8 | module.exports = Object.values(rulesExport); 9 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/line-no-trailing-whitespace.js: -------------------------------------------------------------------------------- 1 | var Issue = require('../issue'); 2 | 3 | module.exports = { 4 | name: 'line-no-trailing-whitespace', 5 | on: ['line'], 6 | desc: 'If set, lines may not end with whitespace characters.' 7 | }; 8 | 9 | module.exports.lint = function (line, opts) { 10 | var i = line.line.search(/[^\S\n\r]+[\n\r]*$/); 11 | return i === -1 ? [] : new Issue('E055', [line.row, i]); 12 | }; 13 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/origin-tag.js: -------------------------------------------------------------------------------- 1 | var knife = require('../knife'), 2 | proc = require('../process_option'); 3 | 4 | module.exports = { 5 | name: 'origin-tag', 6 | on: ['dom'], 7 | filter: ['tag'], 8 | hooks: ['skip-normal-tag'] 9 | }; 10 | 11 | module.exports.lint = function(element, opts) { 12 | var matcher = knife.matchFilter.bind(knife, element.name); 13 | var s = this.subscribers.filter(matcher); 14 | return knife.applyRules(s, element, opts); 15 | }; 16 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/table-req-caption.js: -------------------------------------------------------------------------------- 1 | var Issue = require('../issue'); 2 | 3 | module.exports = { 4 | name: 'table-req-caption', 5 | on: ['tag'], 6 | filter: ['table'], 7 | desc: 'If set, each `table` must contain at least one `caption` tag.' 8 | }; 9 | 10 | module.exports.lint = function (ele, opts) { 11 | return ele.children.some(function (c) { return c.name === 'caption'; }) 12 | ? [] 13 | : new Issue('E031', ele.openLineCol); 14 | }; 15 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/tag-name-lowercase.js: -------------------------------------------------------------------------------- 1 | var Issue = require('../issue'); 2 | 3 | module.exports = { 4 | name: 'tag-name-lowercase', 5 | on: ['tag'], 6 | desc: [ 7 | 'If set, tag names must be lowercase.', 8 | 'Only the opening tag is checked; mismatches between open and close tags', 9 | 'are checked by `tag-name-match`.' 10 | ].join('\n') 11 | }; 12 | 13 | module.exports.lint = function (element, opts) { 14 | return /[A-Z]/.test(element.name) 15 | ? new Issue('E017', element.openLineCol) 16 | : []; 17 | }; 18 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/tag.js: -------------------------------------------------------------------------------- 1 | var knife = require('../knife'), 2 | proc = require('../process_option'); 3 | 4 | module.exports = { 5 | name: 'tag', 6 | on: ['dom'], 7 | filter: ['tag'], 8 | hooks: ['skip-origin-tag'] 9 | }; 10 | 11 | module.exports.lint = function(element, opts) { 12 | var matcher = knife.matchFilter.bind(knife, element.name); 13 | var s = this.subscribers.filter(matcher); 14 | return knife.applyRules(s, element, opts); 15 | }; 16 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/text.js: -------------------------------------------------------------------------------- 1 | var knife = require('../knife'), 2 | proc = require('../process_option'); 3 | 4 | module.exports = { 5 | name: 'text', 6 | on: ['dom'], 7 | filter: ['text'] 8 | }; 9 | 10 | module.exports.lint = function(element, opts) { 11 | var matcher = knife.matchFilter.bind(knife, element.data); 12 | var s = this.subscribers.filter(matcher); 13 | return knife.applyRules(s, element, opts); 14 | }; 15 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/title-no-dup.js: -------------------------------------------------------------------------------- 1 | var Issue = require('../issue'); 2 | 3 | module.exports = { 4 | name: 'title-no-dup', 5 | on: ['title'], 6 | desc: 'If set, the `` tag must not appear twice in the head.' 7 | }; 8 | 9 | module.exports.lint = function (titles, opts) { 10 | return titles.length <= 1 11 | ? [] 12 | : new Issue('E028', titles[1].openLineCol, { num: titles.length }); 13 | } 14 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/rules/title.js: -------------------------------------------------------------------------------- 1 | var Issue = require('../issue'), 2 | knife = require('../knife'); 3 | 4 | module.exports = { 5 | name: 'title', 6 | on: ['tag'], 7 | filter: ['head'] 8 | }; 9 | 10 | module.exports.lint = function (elt, opts) { 11 | var titles = elt.children.filter(function (e) { 12 | return e.type === 'tag' && e.name === 'title'; 13 | }); 14 | titles.head = elt; 15 | return knife.applyRules(this.subscribers, titles, opts); 16 | }; 17 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/tools/index.js: -------------------------------------------------------------------------------- 1 | var bulk = require('bulk-require'); 2 | var lodash = require('lodash'); 3 | 4 | // import all the js files in the directory 5 | var utilExports = bulk(__dirname, '!(index).js'); 6 | var utils = {}; 7 | 8 | // mixin all the functions from the exports into utils 9 | lodash.values(utilExports).forEach(function (u) { 10 | lodash.mixin(utils, u); 11 | }); 12 | 13 | // export utils 14 | module.exports = utils; 15 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/lib/tools/is_origin_component.js: -------------------------------------------------------------------------------- 1 | module.exports.isOriginComponent = function(element) { 2 | if (element && element.type === 'tag') { 3 | return /^origin-\w+/.test(element.name); 4 | } else { 5 | return false; 6 | } 7 | } -------------------------------------------------------------------------------- /packages/cml-htmllinter/test/.eslintrc: -------------------------------------------------------------------------------- 1 | --- 2 | globals: 3 | beforeEach: true 4 | describe: true 5 | it: true 6 | expect: true 7 | xit: true -------------------------------------------------------------------------------- /packages/cml-htmllinter/test/fixtures/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/cml-htmllinter/test/fixtures/.gitkeep -------------------------------------------------------------------------------- /packages/cml-htmllinter/test/fixtures/const_rule.js: -------------------------------------------------------------------------------- 1 | var ConstRule = function (issues) { 2 | this.issues = issues; 3 | this.name = 'dom'; // Override normal dom rule 4 | this.description = 'returns a constant issue array for all inputs'; 5 | }; 6 | 7 | module.exports = ConstRule; 8 | 9 | ConstRule.prototype.lint = function () { 10 | return this.issues; 11 | }; 12 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/test/fixtures/sanity.html: -------------------------------------------------------------------------------- 1 | <!DOCTYPE html> 2 | <!-- This file is just a sanity check, no rule should throw 3 | a runtime error on this file --> 4 | <html> 5 | <head> 6 | <meta charset="utf-8"/> 7 | <title>Sanity Check 8 | 9 | 10 |
11 |

Some text

12 |
13 |
14 |

A header

15 | 16 | 17 |
18 | 19 |

Some text

20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/test/unit/inline-config-html/inline-all.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Hello, World! 7 | 8 | 9 | 10 |

Heading

11 |

Paragraph

12 |
13 |
This inside that
14 |
This inside that
15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/test/unit/knife.apply_rules.js: -------------------------------------------------------------------------------- 1 | describe('knife.apply_rules', function () { 2 | var knife = require('../../lib/knife'); 3 | 4 | it('should return [] for no rules', function () { 5 | var output = knife.applyRules(null); 6 | 7 | expect(output).to.be.eql([]); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/test/unit/knife.is_labeable.js: -------------------------------------------------------------------------------- 1 | describe('knife.is_labeable', function () { 2 | var knife = require('../../lib/knife'); 3 | 4 | it('should return false for hidden input element', function () { 5 | var ele = { 6 | type: 'tag', 7 | name: 'input', 8 | attribs: { 9 | type: { 10 | value: 'hidden' 11 | } 12 | } 13 | }; 14 | 15 | var output = knife.isLabeable(ele); 16 | 17 | expect(output).to.be.eql(false); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/cml-htmllinter/test/unit/knife.relative_line_col.js: -------------------------------------------------------------------------------- 1 | describe('knife.relative_line_col', function () { 2 | var knife = require('../../lib/knife'); 3 | 4 | it('should throw when called with an index behind the last', function () { 5 | var posFunc = knife.getLineColFunc('the html', [0, 0]); 6 | 7 | expect(posFunc.bind(this, -10)).to.throw(); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/cml-interface-parser/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | -------------------------------------------------------------------------------- /packages/cml-interface-parser/test/docs/include-interface.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/cml-js-parser/.gitignore: -------------------------------------------------------------------------------- 1 | demo/ 2 | -------------------------------------------------------------------------------- /packages/cml-js-parser/src/visitors/index.js: -------------------------------------------------------------------------------- 1 | const bulk = require('bulk-require'); 2 | const visitorExports = bulk(__dirname, '!(index).js'); 3 | 4 | let visitors = {}; 5 | 6 | Object.values(visitorExports).forEach(visitor => { 7 | Object.assign(visitors, visitor); 8 | }); 9 | 10 | module.exports = visitors; 11 | -------------------------------------------------------------------------------- /packages/cml-vue-loader/.gitignore: -------------------------------------------------------------------------------- 1 | .options-cache-* -------------------------------------------------------------------------------- /packages/cml-vue-loader/README.md: -------------------------------------------------------------------------------- 1 | - 基于vue-loader@14.2.3改造 2 | - css的插入顺序有bug,不采用cml-extract-css-webpack-plugin是 3 | - injectStyle方法在Vue实例的beforeCreated阶段插入导致父组件先插入 4 | - 再插入子组件,所有css也是子组件在后,子组件的优先级高 5 | - 解决办法是在执行模块时就执行injectStyle,模块依赖的组件都是import,import优先执行,就会比本组件的injectStyle之前先执行 -------------------------------------------------------------------------------- /packages/cml-vue-loader/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/loader') 2 | -------------------------------------------------------------------------------- /packages/cml-vue-loader/lib/style-compiler/plugins/trim.js: -------------------------------------------------------------------------------- 1 | const postcss = require('postcss') 2 | 3 | module.exports = postcss.plugin('trim', opts => css => { 4 | css.walk(({ type, raws }) => { 5 | if (type === 'rule' || type === 'atrule') { 6 | raws.before = raws.after = '\n' 7 | } 8 | }) 9 | }) 10 | -------------------------------------------------------------------------------- /packages/cml-vue-loader/lib/template-compiler/url-to-require.js: -------------------------------------------------------------------------------- 1 | module.exports = function urlToRequire (url) { 2 | // same logic as in transform-require.js 3 | const firstChar = url.charAt(0) 4 | if (firstChar === '.' || firstChar === '~' || firstChar === '@') { 5 | if (firstChar === '~') { 6 | const secondChar = url.charAt(1) 7 | url = url.slice(secondChar === '/' ? 2 : 1) 8 | } 9 | return `require("${url}")` 10 | } else { 11 | return `"${url}"` 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/cml-vue-loader/lib/utils/normalize.js: -------------------------------------------------------------------------------- 1 | const IS_TEST = !!process.env.VUE_LOADER_TEST 2 | const fs = require('fs') 3 | const path = require('path') 4 | 5 | exports.lib = file => path.resolve(__dirname, '../', file) 6 | 7 | exports.dep = dep => { 8 | if (IS_TEST) { 9 | return dep 10 | } else if ( 11 | fs.existsSync(path.resolve(__dirname, '../../node_modules', dep)) 12 | ) { 13 | // npm 2 or npm linked 14 | return 'vue-loader/node_modules/' + dep 15 | } else { 16 | // npm 3 17 | return dep 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/cml-vue-loader/lib/utils/try-require.js: -------------------------------------------------------------------------------- 1 | const cwd = process.cwd() 2 | const resolve = require('resolve') 3 | 4 | // attempts to first require a dep using projects cwd (when vue-loader is linked) 5 | // then try a normal require. 6 | module.exports = function tryRequire (dep) { 7 | let fromCwd 8 | try { 9 | fromCwd = resolve.sync(dep, { basedir: cwd }) 10 | } catch (e) {} 11 | if (fromCwd) { 12 | return require(fromCwd) 13 | } else { 14 | try { 15 | return require(dep) 16 | } catch (e) {} 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/easy-chameleon/entry/web_global.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0px; 3 | padding: 0px; 4 | } 5 | 6 | /* 只允许进行滚动和持续缩放操作 */ 7 | a, 8 | button, 9 | [role="button"], 10 | input, 11 | label, 12 | select, 13 | textarea { 14 | touch-action: manipulation; 15 | } 16 | 17 | p, 18 | ol, 19 | ul, 20 | dl, 21 | figure { 22 | margin: 0; 23 | padding: 0; 24 | } 25 | 26 | li { 27 | list-style: none; 28 | } -------------------------------------------------------------------------------- /packages/easy-chameleon/entry/web_global.js: -------------------------------------------------------------------------------- 1 | 2 | import Vue from 'vue'; 3 | require('./web_global.css'); 4 | window.Vue = Vue; 5 | 6 | -------------------------------------------------------------------------------- /packages/easy-chameleon/index.js: -------------------------------------------------------------------------------- 1 | const {getConfig} = require('./config/getWebpackConfig'); 2 | const {styleLoaders, cssLoaders} = require('./config/utils'); 3 | const path = require('path'); 4 | 5 | module.exports = { 6 | getConfig, 7 | styleLoaders, 8 | cssLoaders 9 | } -------------------------------------------------------------------------------- /packages/easy-chameleon/postcss/web/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | module.exports = { 3 | "plugins": { 4 | // to edit target browsers: use "browserslist" field in package.json 5 | "postcss-import": {}, 6 | "postcss-plugin-weex":{}, 7 | "autoprefixer": { 8 | browsers: ['> 0.1%', 'ios >= 8', 'not ie < 12'] 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /packages/easy-chameleon/postcss/weex/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | module.exports = { 3 | "plugins": { 4 | // to edit target browsers: use "browserslist" field in package.json 5 | "postcss-import": {}, 6 | } 7 | } -------------------------------------------------------------------------------- /packages/easy-chameleon/postcss/wx/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | module.exports = { 3 | "plugins": { 4 | // to edit target browsers: use "browserslist" field in package.json 5 | "postcss-import": {} 6 | } 7 | } -------------------------------------------------------------------------------- /packages/interface-loader/.npmignore: -------------------------------------------------------------------------------- 1 | .scripts/ 2 | test/ 3 | gulpfile.js -------------------------------------------------------------------------------- /packages/interface-loader/src/index.js: -------------------------------------------------------------------------------- 1 | 2 | const loaderUtils = require('loader-utils') 3 | const mvvmInterfaceParser = require('mvvm-interface-parser'); 4 | module.exports = function (source) { 5 | const rawOptions = loaderUtils.getOptions(this); 6 | const options = rawOptions || {}; 7 | // loader的类型 wx web weex 8 | let {cmlType, media, check = {}} = options; 9 | const filePath = this.resourcePath; 10 | // todo 11 | let {result, devDeps} = mvvmInterfaceParser({cmlType, media, source, filePath, check}); 12 | devDeps.forEach(item => { 13 | this.addDependency(item); 14 | }) 15 | return result; 16 | } 17 | -------------------------------------------------------------------------------- /packages/mvvm-babel-parser/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "8" 4 | script: 5 | - npm run cover 6 | after_script: "cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js" 7 | -------------------------------------------------------------------------------- /packages/mvvm-babel-parser/README.md: -------------------------------------------------------------------------------- 1 | #### 基于 @babel/parser@7.1.0 进行改造 jsx支持cml语法 -------------------------------------------------------------------------------- /packages/mvvm-babel-parser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mvvm-babel-parser", 3 | "version": "1.0.8", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "directories": { 7 | "lib": "lib", 8 | "test": "test" 9 | }, 10 | "dependencies": { 11 | "babel-generator": "6.26.1", 12 | "babel-traverse": "6.26.0", 13 | "babel-types": "6.26.0", 14 | "chai": "^4.2.0" 15 | }, 16 | "scripts": { 17 | "test": "mocha" 18 | }, 19 | "author": "Chameleon-Team", 20 | "license": "Apache" 21 | } -------------------------------------------------------------------------------- /packages/mvvm-babel-parser/test/testjsx.tpl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/mvvm-cml-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mvvm-cml-loader", 3 | "version": "1.0.8", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Chameleon-Team", 10 | "license": "Apache", 11 | "dependencies": { 12 | "chameleon-loader": "1.0.8", 13 | "chameleon-tool-utils": "1.0.8", 14 | "loader-utils": "1.1.0", 15 | "mvvm-template-parser": "1.0.8" 16 | } 17 | } -------------------------------------------------------------------------------- /packages/mvvm-file-loader/dist/cjs.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var loader = require('./index'); 4 | 5 | module.exports = loader.default; 6 | module.exports.raw = loader.raw; -------------------------------------------------------------------------------- /packages/mvvm-file-loader/dist/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "object", 3 | "properties": { 4 | "name": {}, 5 | "regExp": {}, 6 | "context": { 7 | "type": "string" 8 | }, 9 | "publicPath": {}, 10 | "outputPath": {}, 11 | "useRelativePath": { 12 | "type": "boolean" 13 | }, 14 | "emitFile": { 15 | "type": "boolean" 16 | } 17 | }, 18 | "additionalProperties": true 19 | } 20 | -------------------------------------------------------------------------------- /packages/mvvm-file-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mvvm-file-loader", 3 | "version": "1.0.8", 4 | "description": "mvvm file loader", 5 | "main": "dist/cjs.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "dependencies": { 10 | "loader-utils": "^1.0.2", 11 | "mime": "^2.4.2", 12 | "schema-utils": "^0.4.5" 13 | }, 14 | "author": "Chameleon-Team", 15 | "license": "Apache" 16 | } -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/README.md: -------------------------------------------------------------------------------- 1 | #### 使用 2 | chameleon-loader和interface-loader中获取interface文件内容时使用 3 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/runtime/copyProto.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = function copyProtoProperty(obj) { 3 | var EXPORT_OBJ = obj || {}; 4 | var EXPORT_PROTO = Object.getPrototypeOf(EXPORT_OBJ); 5 | if (EXPORT_PROTO.constructor !== Object) { 6 | Object.getOwnPropertyNames(EXPORT_PROTO).forEach(function(key) { 7 | if (!/constructor|prototype|length/ig.test(key)) { 8 | // 原型上有自身没有的属性 放到自身上 9 | if (!EXPORT_OBJ.hasOwnProperty(key)) { 10 | EXPORT_OBJ[key] = EXPORT_PROTO[key] 11 | } 12 | } 13 | }) 14 | } 15 | return EXPORT_OBJ; 16 | } 17 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/copyProto.test.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const _ = require('../runtime/copyProto.js'); 4 | const expect = require('chai').expect; 5 | class A { 6 | fun1() { 7 | console.log('fun1') 8 | } 9 | } 10 | 11 | describe('mvvm-interface-parser/getMethodCode', function() { 12 | it('copyProto.js', function() { 13 | var obj = new A(); 14 | _(obj); 15 | expect(obj.hasOwnProperty('fun1')) 16 | }) 17 | 18 | }) 19 | 20 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/comb/comb.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/first/test.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/methodinclude.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/methodsrcerror.interface: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/partsrcerror.interface: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/ph-com/ph-com.interface: -------------------------------------------------------------------------------- 1 | 22 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/second/second.interface: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 25 | 26 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/third.interface: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/third/double.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/third/includea.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/third/includeb.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/third/multi.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/third/not.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/third/third.interface: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-interface-parser/test/lib/components/third/third.interface -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/thirdinterface.js: -------------------------------------------------------------------------------- 1 | `interface FirstInterface { 2 | getMsg(msg: String): String; 3 | }` 4 | -------------------------------------------------------------------------------- /packages/mvvm-interface-parser/test/lib/components/thirdmethod.js: -------------------------------------------------------------------------------- 1 | `thirdmethods` -------------------------------------------------------------------------------- /packages/mvvm-miniapp-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mvvm-miniapp-loader", 3 | "version": "1.0.8", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Chameleon-Team", 10 | "license": "Apache", 11 | "dependencies": { 12 | "loader-utils": "^1.2.3" 13 | } 14 | } -------------------------------------------------------------------------------- /packages/mvvm-pack/index.js: -------------------------------------------------------------------------------- 1 | const MvvmGraphPlugin = require('./mvvmGraphPlugin.js'); 2 | const MvvMCompiler = require('./compiler.js'); 3 | 4 | module.exports = { 5 | MvvmGraphPlugin, 6 | MvvMCompiler 7 | } -------------------------------------------------------------------------------- /packages/mvvm-pack/lib/amdwrapper.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = function({content, modId}) { 3 | if (!/^\s*cmldefine\s*\(/.test(content)) { 4 | content = `\ncmldefine('${modId}', function(require, exports, module) { 5 | ${content} 6 | })`; 7 | } 8 | return content; 9 | } -------------------------------------------------------------------------------- /packages/mvvm-pack/minimize/uglifycss.js: -------------------------------------------------------------------------------- 1 | let csso = require('csso'); 2 | 3 | module.exports = function(content, filePath) { 4 | let result = csso.minify(content, {}); 5 | return result.css; 6 | } -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/coma/coma.interface: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/coma/coma.interface -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/comb/comb.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/comb/comb.cml -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/index.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/index.cml -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/chameleon-ui-builtin/components/button/button.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/node_modules/chameleon-ui-builtin/components/button/button.cml -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/chameleon-ui-builtin/components/button/button.interface: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/chameleon-ui-builtin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "copy-npm", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "components", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "cml": { 12 | "wx": { 13 | "pages": [ 14 | "/pages/index/index" 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-pages/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "copy-npm", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "cml": { 12 | "pages": "/pages/index/index" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-pages/src/router.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "history", 3 | "domain": "https://www.chameleon.com", 4 | "routes":[ 5 | { 6 | "url": "/cml/h5/index", 7 | "path": "/pages/page1/page1", 8 | "name": "首页", 9 | "mock": "index.php" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/mock/api/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = [ 3 | { 4 | method: ['get', 'post'], 5 | path: '/api/getMessage', 6 | controller: function (req, res, next) { 7 | res.json({ 8 | total: 0, 9 | message: [{ 10 | name: 'Hello chameleon!' 11 | }] 12 | }); 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/mock/template/index.php: -------------------------------------------------------------------------------- 1 | "0", 4 | "errmsg"=> "", 5 | "pageData"=> array( 6 | "name"=>"chameleon", 7 | "age" => 10 8 | ) 9 | ); -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chameleon", 3 | "version": "1.0.0", 4 | "description": "A chameleon project", 5 | "author": "", 6 | "private": true, 7 | "scripts": {}, 8 | "license": "MIT", 9 | "dependencies": { 10 | "chameleon-api": "0.4.3", 11 | "chameleon-bridge": "0.1.2", 12 | "chameleon-runtime": "0.1.4", 13 | "chameleon-store": "0.0.3", 14 | "chameleon-ui-builtin": "^0.2.0", 15 | "cml-ui": "0.1.7" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/src/assets/images/chameleon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/src/assets/images/chameleon.png -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/src/router.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "history", 3 | "domain": "https://www.chameleon.com", 4 | "routes":[ 5 | { 6 | "url": "/cml/h5/index", 7 | "path": "/pages/index/index", 8 | "name": "首页", 9 | "mock": "index.php" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/src/store/actions.js: -------------------------------------------------------------------------------- 1 | 2 | export default { 3 | } 4 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/src/store/getters.js: -------------------------------------------------------------------------------- 1 | export default { 2 | } 3 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/src/store/index.js: -------------------------------------------------------------------------------- 1 | import actions from './actions' 2 | import getters from './getters' 3 | import state from './state' 4 | import mutations from './mutations' 5 | import createStore from "chameleon-store"; 6 | 7 | export default createStore({ 8 | actions, 9 | getters, 10 | state, 11 | mutations 12 | }) 13 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/src/store/mutations.js: -------------------------------------------------------------------------------- 1 | 2 | export default { 3 | } 4 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/cml-subproject/src/store/state.js: -------------------------------------------------------------------------------- 1 | 2 | const state = { 3 | } 4 | 5 | export default state 6 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/copy-npm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "copy-npm", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "cml": { 12 | "wx": { 13 | "pages": [ 14 | "/pages/index/index" 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/npm-components/components/button/button.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/node_modules/npm-components/components/button/button.cml -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/npm-components/components/button/button.interface: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/npm-components/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "copy-npm", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "components", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "cml": { 12 | "wx": { 13 | "pages": [ 14 | "/pages/index/index" 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/vant-weapp/test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/node_modules/vant-weapp/test.js -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/vant-weapp/test.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/vant-weapp/test.wxml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/node_modules/vant-weapp/test.wxss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/node_modules/vant-weapp/test.wxss -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fse", 3 | "version": "1.0.0", 4 | "description": "A chameleon project", 5 | "author": "", 6 | "private": true, 7 | "scripts": {}, 8 | "license": "MIT", 9 | "dependencies": { 10 | "chameleon-runtime": "~1.1.0", 11 | "chameleon-store": "~1.0.0", 12 | "cml-ui": "~1.0.0", 13 | "chameleon-ui-builtin": "~1.0.0", 14 | "chameleon-api": "~0.1.0", 15 | "chameleon-bridge": "~0.1.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/src/components/comb/comb.interface: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/src/components/comb/comb.web.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/src/components/comb/comb.web.cml -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/src/components/comb/comb.wx.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/src/components/comb/comb.wx.cml -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/src/components/comc/comc.interface: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/src/components/comc/comc.interface -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/src/pages/pageb/pageb.cml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/demo-project/src/pages/pageb/pageb.cml -------------------------------------------------------------------------------- /packages/mvvm-pack/test/demo-project/src/router.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "history", 3 | "domain": "https://www.chameleon.com", 4 | "routes":[ 5 | { 6 | "url": "/cml/h5/index", 7 | "path": "/pages/pagea/pagea", 8 | "name": "首页", 9 | "mock": "index.php" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/mvvm-pack/test/log.test.js: -------------------------------------------------------------------------------- 1 | 2 | var Log = require('../log.js') 3 | 4 | describe('log', function() { 5 | it('log.js', function() { 6 | let log = new Log(); 7 | log.debug('debug') 8 | log.notice('notice') 9 | log.warn('warn') 10 | log.error('error') 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /packages/mvvm-pack/test/test.wxml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-pack/test/test.wxml -------------------------------------------------------------------------------- /packages/mvvm-pack/test/uglifycss.test.js: -------------------------------------------------------------------------------- 1 | let _ = require('../minimize/uglifycss'); 2 | const expect = require('chai').expect; 3 | 4 | describe('uglifycss', function() { 5 | it('normal css', function() { 6 | let code = ` 7 | .class1 { 8 | font-size: 24px; 9 | } 10 | .class2 { 11 | color: red; 12 | -webkit-box-orient: block-axis; 13 | } 14 | ` 15 | let result = _(code) 16 | expect(result).to.be.equal('.class1{font-size:24px}.class2{color:red;-webkit-box-orient:block-axis}') 17 | }) 18 | 19 | }) 20 | 21 | -------------------------------------------------------------------------------- /packages/mvvm-style-loader/index.js: -------------------------------------------------------------------------------- 1 | 2 | const {assets} = require('./lib.js'); 3 | 4 | /** 5 | * 1.为style模块包装 防止webpack build moudle error 6 | * 2.处理css中的静态资源 css中改成绝对路径 loader过后进行替换publicPath 7 | */ 8 | module.exports = function(content) { 9 | this._module._nodeType = 'module'; 10 | this._module._moduleType = 'style'; 11 | let {source, deps} = assets({source: content,loaderContext: this}); 12 | this._module._cmlSource = source; 13 | let output = ''; 14 | deps.forEach(item=>{ 15 | output += `require("${item}")` 16 | }) 17 | return ` 18 | ${output} 19 | module.exports = {}` 20 | } 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/mvvm-style-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mvvm-style-loader", 3 | "version": "1.0.8", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "cover": "istanbul cover --report lcov _mocha -- -R spec --recursive", 8 | "test": "mocha --recursive --reporter spec" 9 | }, 10 | "author": "Chameleon-Team", 11 | "license": "Apache", 12 | "dependencies": { 13 | "postcss": "7.0.14", 14 | "chameleon-tool-utils": "1.0.8" 15 | }, 16 | "devDependencies": { 17 | "chai": "^4.2.0", 18 | "eslint": "^5.9.0", 19 | "istanbul": "^0.4.5", 20 | "mocha": "^5.2.0" 21 | } 22 | } -------------------------------------------------------------------------------- /packages/mvvm-style-loader/test/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didi/chameleon/3531c7444cc2c5f800258a2fe35858c74ec79d21/packages/mvvm-style-loader/test/1.png -------------------------------------------------------------------------------- /packages/mvvm-template-parser/README.md: -------------------------------------------------------------------------------- 1 | #### mvvm协议标准中处理cml文件template部分 -------------------------------------------------------------------------------- /packages/runtime-check/index.js: -------------------------------------------------------------------------------- 1 | const parsePlugins = require('./parsePlugins.js'); 2 | const getDefines = require('./getDefines.js'); 3 | 4 | module.exports = { 5 | parsePlugins, 6 | getDefines 7 | } 8 | 9 | -------------------------------------------------------------------------------- /packages/runtime-check/parsePlugins.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * parse 代码时的ES语法扩展需要的插件 4 | */ 5 | module.exports = [ 6 | 'flow', 7 | 'asyncGenerators', 8 | 'bigInt', 9 | 'classProperties', 10 | 'classPrivateProperties', 11 | 'classPrivateMethods', 12 | 'doExpressions', 13 | 'dynamicImport', 14 | 'exportDefaultFrom', 15 | 'exportNamespaceFrom', 16 | 'functionBind', 17 | 'functionSent', 18 | 'importMeta', 19 | 'logicalAssignment', 20 | 'nullishCoalescingOperator', 21 | 'numericSeparator', 22 | 'objectRestSpread', 23 | 'optionalCatchBinding', 24 | 'optionalChaining', 25 | 'throwExpressions' 26 | ] 27 | -------------------------------------------------------------------------------- /packages/url-loader/.eslintignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /dist 3 | 4 | -------------------------------------------------------------------------------- /packages/url-loader/.gitattributes: -------------------------------------------------------------------------------- 1 | package-lock.json -diff 2 | * text=auto 3 | bin/* eol=lf 4 | -------------------------------------------------------------------------------- /packages/url-loader/.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These are the default owners for everything in 2 | # webpack-contrib 3 | @webpack-contrib/org-maintainers 4 | 5 | # Add repository specific users / groups 6 | # below here for libs that are not maintained by the org. 7 | -------------------------------------------------------------------------------- /packages/url-loader/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /packages/url-loader/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | logs 3 | *.log 4 | npm-debug.log* 5 | .eslintcache 6 | /coverage 7 | /dist 8 | /local 9 | /reports 10 | .DS_Store 11 | Thumbs.db 12 | .idea 13 | .vscode 14 | *.sublime-project 15 | *.sublime-workspace -------------------------------------------------------------------------------- /packages/url-loader/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "es5", 4 | "arrowParens": "always" 5 | } 6 | -------------------------------------------------------------------------------- /packages/url-loader/codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | branch: master 3 | coverage: 4 | precision: 2 5 | round: down 6 | range: 70...100 7 | status: 8 | project: 'no' 9 | patch: 'yes' 10 | comment: 'off' 11 | -------------------------------------------------------------------------------- /packages/url-loader/src/cjs.js: -------------------------------------------------------------------------------- 1 | const loader = require('./index'); 2 | 3 | module.exports = loader["default"]; 4 | module.exports.raw = loader.raw; 5 | -------------------------------------------------------------------------------- /packages/webpack-liveload-middleware/helpers.js: -------------------------------------------------------------------------------- 1 | var parse = require('url').parse; 2 | 3 | exports.pathMatch = function(url, path) { 4 | try { 5 | return parse(url).pathname === path; 6 | } catch (e) { 7 | return false; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/webpack-liveload-middleware/test/helpers.test.js: -------------------------------------------------------------------------------- 1 | const {pathMatch} = require('../helpers.js'); 2 | const {expect} = require('chai'); 3 | 4 | describe('test helpers.js', function() { 5 | it('test parse url', function() { 6 | let url = 'https://www.chameleon.com/path/to/index?query=username&query1=age'; 7 | let result = pathMatch(url, `/path/to/index`); 8 | expect(result).to.be.ok; 9 | }) 10 | }) 11 | -------------------------------------------------------------------------------- /test/test.sh: -------------------------------------------------------------------------------- 1 | node_modules/.bin/nyc --reporter=lcov node_modules/.bin/mocha packages/*/test/**/*.test.js packages/*/test/**/**/*.test.js packages/*/test/**/**/**/*.test.js packages/*/test/**/**/**/**/*.test.js 2 | --------------------------------------------------------------------------------