@cloudbase/cals 1.1.14 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{parser → cjs/parser}/cals/index.d.ts +1 -1
- package/lib/cjs/parser/cals/index.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/block/helpers/get-component-namespace.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/block/helpers/merge-dataset.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/block/helpers/merge-listeners.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/block/helpers/merge-resources.d.ts.map +1 -0
- package/lib/{parser → cjs/parser}/cals/utils/block/helpers/remap-component-ids.d.ts +2 -2
- package/lib/cjs/parser/cals/utils/block/helpers/remap-component-ids.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/block/helpers/renew-id-in-code.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/block/helpers/renew-id-in-expr.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/block/helpers/renew-id-in-resource.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/block/helpers/resolve-new-id.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/block/index.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/code/index.d.ts.map +1 -0
- package/lib/{parser → cjs/parser}/cals/utils/common.d.ts +1 -1
- package/lib/cjs/parser/cals/utils/common.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/getUsedReference.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/getUsedResources.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/runtime.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/spinoff/index.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/style.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/template.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/version/common.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/version/config.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/version/index.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/version/parses.d.ts.map +1 -0
- package/lib/cjs/parser/cals/utils/version/utils.d.ts.map +1 -0
- package/lib/cjs/parser/dependiencies/index.d.ts.map +1 -0
- package/lib/cjs/parser/expression/index.d.ts.map +1 -0
- package/lib/cjs/parser/index.d.ts.map +1 -0
- package/lib/cjs/parser/plugins/postcss-rpx2clac.d.ts.map +1 -0
- package/lib/cjs/types/basic/app.d.ts.map +1 -0
- package/lib/cjs/types/basic/common.d.ts.map +1 -0
- package/lib/cjs/types/basic/component.d.ts.map +1 -0
- package/lib/cjs/types/basic/datasource.d.ts.map +1 -0
- package/lib/cjs/types/index.d.ts.map +1 -0
- package/lib/{types → cjs/types}/lcds.d.ts +4 -4
- package/lib/cjs/types/lcds.d.ts.map +1 -0
- package/lib/{types → cjs/types}/platform/app.d.ts +2 -2
- package/lib/cjs/types/platform/app.d.ts.map +1 -0
- package/lib/cjs/types/platform/common.d.ts.map +1 -0
- package/lib/{types → cjs/types}/platform/component.d.ts +1 -1
- package/lib/cjs/types/platform/component.d.ts.map +1 -0
- package/lib/{types → cjs/types}/platform/datasource.d.ts +4 -4
- package/lib/cjs/types/platform/datasource.d.ts.map +1 -0
- package/lib/cjs/types/platform/eventFlow.d.ts.map +1 -0
- package/lib/cjs/types/platform/query.d.ts.map +1 -0
- package/lib/{types → cjs/types}/platform/theme.d.ts +4 -4
- package/lib/cjs/types/platform/theme.d.ts.map +1 -0
- package/lib/cjs/utils/CSSProperty.d.ts.map +1 -0
- package/lib/cjs/utils/color-generator/core.d.ts.map +1 -0
- package/lib/cjs/utils/color-generator/generate.d.ts.map +1 -0
- package/lib/cjs/utils/color-generator/utils.d.ts.map +1 -0
- package/lib/cjs/utils/constant.d.ts.map +1 -0
- package/lib/cjs/utils/dts/auto-generated.d.ts.map +1 -0
- package/lib/{utils → cjs/utils}/dts/build.d.ts.map +1 -1
- package/lib/cjs/utils/dts/index.d.ts.map +1 -0
- package/lib/cjs/utils/index.d.ts.map +1 -0
- package/lib/cjs/utils/version/common.d.ts.map +1 -0
- package/lib/cjs/utils/version/featureChecker.d.ts.map +1 -0
- package/lib/cjs/utils/version/migrations/version4.d.ts.map +1 -0
- package/lib/esm/parser/cals/index.d.ts +625 -0
- package/lib/esm/parser/cals/index.d.ts.map +1 -0
- package/lib/esm/parser/cals/index.js +1548 -0
- package/lib/esm/parser/cals/utils/block/helpers/get-component-namespace.d.ts +2 -0
- package/lib/esm/parser/cals/utils/block/helpers/get-component-namespace.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/block/helpers/get-component-namespace.js +5 -0
- package/lib/esm/parser/cals/utils/block/helpers/merge-dataset.d.ts +6 -0
- package/lib/esm/parser/cals/utils/block/helpers/merge-dataset.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/block/helpers/merge-dataset.js +13 -0
- package/lib/esm/parser/cals/utils/block/helpers/merge-listeners.d.ts +6 -0
- package/lib/esm/parser/cals/utils/block/helpers/merge-listeners.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/block/helpers/merge-listeners.js +10 -0
- package/lib/esm/parser/cals/utils/block/helpers/merge-resources.d.ts +6 -0
- package/lib/esm/parser/cals/utils/block/helpers/merge-resources.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/block/helpers/merge-resources.js +25 -0
- package/lib/esm/parser/cals/utils/block/helpers/remap-component-ids.d.ts +30 -0
- package/lib/esm/parser/cals/utils/block/helpers/remap-component-ids.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/block/helpers/remap-component-ids.js +125 -0
- package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-code.d.ts +7 -0
- package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-code.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-code.js +9 -0
- package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-expr.d.ts +8 -0
- package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-expr.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-expr.js +56 -0
- package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-resource.d.ts +15 -0
- package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-resource.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-resource.js +13 -0
- package/lib/esm/parser/cals/utils/block/helpers/resolve-new-id.d.ts +7 -0
- package/lib/esm/parser/cals/utils/block/helpers/resolve-new-id.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/block/helpers/resolve-new-id.js +17 -0
- package/lib/esm/parser/cals/utils/block/index.d.ts +67 -0
- package/lib/esm/parser/cals/utils/block/index.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/block/index.js +451 -0
- package/lib/esm/parser/cals/utils/code/index.d.ts +36 -0
- package/lib/esm/parser/cals/utils/code/index.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/code/index.js +401 -0
- package/lib/esm/parser/cals/utils/common.d.ts +35 -0
- package/lib/esm/parser/cals/utils/common.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/common.js +301 -0
- package/lib/esm/parser/cals/utils/getUsedReference.d.ts +8 -0
- package/lib/esm/parser/cals/utils/getUsedReference.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/getUsedReference.js +54 -0
- package/lib/esm/parser/cals/utils/getUsedResources.d.ts +10 -0
- package/lib/esm/parser/cals/utils/getUsedResources.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/getUsedResources.js +132 -0
- package/lib/esm/parser/cals/utils/runtime.d.ts +14 -0
- package/lib/esm/parser/cals/utils/runtime.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/runtime.js +254 -0
- package/lib/esm/parser/cals/utils/spinoff/index.d.ts +10 -0
- package/lib/esm/parser/cals/utils/spinoff/index.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/spinoff/index.js +95 -0
- package/lib/esm/parser/cals/utils/style.d.ts +43 -0
- package/lib/esm/parser/cals/utils/style.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/style.js +463 -0
- package/lib/esm/parser/cals/utils/template.d.ts +6 -0
- package/lib/esm/parser/cals/utils/template.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/template.js +221 -0
- package/lib/esm/parser/cals/utils/version/common.d.ts +5 -0
- package/lib/esm/parser/cals/utils/version/common.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/version/common.js +375 -0
- package/lib/esm/parser/cals/utils/version/config.d.ts +16 -0
- package/lib/esm/parser/cals/utils/version/config.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/version/config.js +241 -0
- package/lib/esm/parser/cals/utils/version/index.d.ts +3 -0
- package/lib/esm/parser/cals/utils/version/index.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/version/index.js +68 -0
- package/lib/esm/parser/cals/utils/version/parses.d.ts +16 -0
- package/lib/esm/parser/cals/utils/version/parses.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/version/parses.js +560 -0
- package/lib/esm/parser/cals/utils/version/utils.d.ts +14 -0
- package/lib/esm/parser/cals/utils/version/utils.d.ts.map +1 -0
- package/lib/esm/parser/cals/utils/version/utils.js +129 -0
- package/lib/esm/parser/dependiencies/index.d.ts +143 -0
- package/lib/esm/parser/dependiencies/index.d.ts.map +1 -0
- package/lib/esm/parser/dependiencies/index.js +684 -0
- package/lib/esm/parser/expression/index.d.ts +123 -0
- package/lib/esm/parser/expression/index.d.ts.map +1 -0
- package/lib/esm/parser/expression/index.js +296 -0
- package/lib/esm/parser/index.d.ts +13 -0
- package/lib/esm/parser/index.d.ts.map +1 -0
- package/lib/esm/parser/index.js +12 -0
- package/lib/esm/parser/plugins/postcss-rpx2clac.d.ts +18 -0
- package/lib/esm/parser/plugins/postcss-rpx2clac.d.ts.map +1 -0
- package/lib/esm/parser/plugins/postcss-rpx2clac.js +67 -0
- package/lib/esm/types/basic/app.d.ts +76 -0
- package/lib/esm/types/basic/app.d.ts.map +1 -0
- package/lib/esm/types/basic/app.js +1 -0
- package/lib/esm/types/basic/common.d.ts +125 -0
- package/lib/esm/types/basic/common.d.ts.map +1 -0
- package/lib/esm/types/basic/common.js +1 -0
- package/lib/esm/types/basic/component.d.ts +212 -0
- package/lib/esm/types/basic/component.d.ts.map +1 -0
- package/lib/esm/types/basic/component.js +1 -0
- package/lib/esm/types/basic/datasource.d.ts +50 -0
- package/lib/esm/types/basic/datasource.d.ts.map +1 -0
- package/lib/esm/types/basic/datasource.js +1 -0
- package/lib/esm/types/index.d.ts +12 -0
- package/lib/esm/types/index.d.ts.map +1 -0
- package/lib/esm/types/index.js +14 -0
- package/lib/esm/types/lcds.d.ts +610 -0
- package/lib/esm/types/lcds.d.ts.map +1 -0
- package/lib/esm/types/lcds.js +22 -0
- package/lib/esm/types/platform/app.d.ts +276 -0
- package/lib/esm/types/platform/app.d.ts.map +1 -0
- package/lib/esm/types/platform/app.js +8 -0
- package/lib/esm/types/platform/common.d.ts +190 -0
- package/lib/esm/types/platform/common.d.ts.map +1 -0
- package/lib/esm/types/platform/common.js +84 -0
- package/lib/esm/types/platform/component.d.ts +166 -0
- package/lib/esm/types/platform/component.d.ts.map +1 -0
- package/lib/esm/types/platform/component.js +8 -0
- package/lib/esm/types/platform/datasource.d.ts +500 -0
- package/lib/esm/types/platform/datasource.d.ts.map +1 -0
- package/lib/esm/types/platform/datasource.js +6 -0
- package/lib/esm/types/platform/eventFlow.d.ts +20 -0
- package/lib/esm/types/platform/eventFlow.d.ts.map +1 -0
- package/lib/esm/types/platform/eventFlow.js +1 -0
- package/lib/esm/types/platform/query.d.ts +78 -0
- package/lib/esm/types/platform/query.d.ts.map +1 -0
- package/lib/esm/types/platform/query.js +12 -0
- package/lib/esm/types/platform/theme.d.ts +47 -0
- package/lib/esm/types/platform/theme.d.ts.map +1 -0
- package/lib/esm/types/platform/theme.js +1 -0
- package/lib/esm/utils/CSSProperty.d.ts +64 -0
- package/lib/esm/utils/CSSProperty.d.ts.map +1 -0
- package/lib/esm/utils/CSSProperty.js +86 -0
- package/lib/esm/utils/color-generator/core.d.ts +52 -0
- package/lib/esm/utils/color-generator/core.d.ts.map +1 -0
- package/lib/esm/utils/color-generator/core.js +57 -0
- package/lib/esm/utils/color-generator/generate.d.ts +67 -0
- package/lib/esm/utils/color-generator/generate.d.ts.map +1 -0
- package/lib/esm/utils/color-generator/generate.js +92 -0
- package/lib/esm/utils/color-generator/utils.d.ts +15 -0
- package/lib/esm/utils/color-generator/utils.d.ts.map +1 -0
- package/lib/esm/utils/color-generator/utils.js +30 -0
- package/lib/esm/utils/constant.d.ts +65 -0
- package/lib/esm/utils/constant.d.ts.map +1 -0
- package/lib/esm/utils/constant.js +69 -0
- package/lib/esm/utils/dts/auto-generated.d.ts +2 -0
- package/lib/esm/utils/dts/auto-generated.d.ts.map +1 -0
- package/lib/esm/utils/dts/auto-generated.js +1796 -0
- package/lib/esm/utils/dts/build.d.ts +2 -0
- package/lib/esm/utils/dts/build.d.ts.map +1 -0
- package/lib/esm/utils/dts/build.js +147 -0
- package/lib/esm/utils/dts/index.d.ts +141 -0
- package/lib/esm/utils/dts/index.d.ts.map +1 -0
- package/lib/esm/utils/dts/index.js +1071 -0
- package/lib/esm/utils/index.d.ts +9 -0
- package/lib/esm/utils/index.d.ts.map +1 -0
- package/lib/esm/utils/index.js +8 -0
- package/lib/esm/utils/version/common.d.ts +3 -0
- package/lib/esm/utils/version/common.d.ts.map +1 -0
- package/lib/esm/utils/version/common.js +22 -0
- package/lib/esm/utils/version/featureChecker.d.ts +5 -0
- package/lib/esm/utils/version/featureChecker.d.ts.map +1 -0
- package/lib/esm/utils/version/featureChecker.js +32 -0
- package/lib/esm/utils/version/migrations/version4.d.ts +3 -0
- package/lib/esm/utils/version/migrations/version4.d.ts.map +1 -0
- package/lib/esm/utils/version/migrations/version4.js +192 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +7 -5
- package/lib/parser/cals/index.d.ts.map +0 -1
- package/lib/parser/cals/utils/block/helpers/get-component-namespace.d.ts.map +0 -1
- package/lib/parser/cals/utils/block/helpers/merge-dataset.d.ts.map +0 -1
- package/lib/parser/cals/utils/block/helpers/merge-listeners.d.ts.map +0 -1
- package/lib/parser/cals/utils/block/helpers/merge-resources.d.ts.map +0 -1
- package/lib/parser/cals/utils/block/helpers/remap-component-ids.d.ts.map +0 -1
- package/lib/parser/cals/utils/block/helpers/renew-id-in-code.d.ts.map +0 -1
- package/lib/parser/cals/utils/block/helpers/renew-id-in-expr.d.ts.map +0 -1
- package/lib/parser/cals/utils/block/helpers/renew-id-in-resource.d.ts.map +0 -1
- package/lib/parser/cals/utils/block/helpers/resolve-new-id.d.ts.map +0 -1
- package/lib/parser/cals/utils/block/index.d.ts.map +0 -1
- package/lib/parser/cals/utils/code/index.d.ts.map +0 -1
- package/lib/parser/cals/utils/common.d.ts.map +0 -1
- package/lib/parser/cals/utils/getUsedReference.d.ts.map +0 -1
- package/lib/parser/cals/utils/getUsedResources.d.ts.map +0 -1
- package/lib/parser/cals/utils/runtime.d.ts.map +0 -1
- package/lib/parser/cals/utils/spinoff/index.d.ts.map +0 -1
- package/lib/parser/cals/utils/style.d.ts.map +0 -1
- package/lib/parser/cals/utils/template.d.ts.map +0 -1
- package/lib/parser/cals/utils/version/common.d.ts.map +0 -1
- package/lib/parser/cals/utils/version/config.d.ts.map +0 -1
- package/lib/parser/cals/utils/version/index.d.ts.map +0 -1
- package/lib/parser/cals/utils/version/parses.d.ts.map +0 -1
- package/lib/parser/cals/utils/version/utils.d.ts.map +0 -1
- package/lib/parser/dependiencies/index.d.ts.map +0 -1
- package/lib/parser/expression/index.d.ts.map +0 -1
- package/lib/parser/index.d.ts.map +0 -1
- package/lib/parser/plugins/postcss-rpx2clac.d.ts.map +0 -1
- package/lib/types/basic/app.d.ts.map +0 -1
- package/lib/types/basic/common.d.ts.map +0 -1
- package/lib/types/basic/component.d.ts.map +0 -1
- package/lib/types/basic/datasource.d.ts.map +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/lcds.d.ts.map +0 -1
- package/lib/types/platform/app.d.ts.map +0 -1
- package/lib/types/platform/common.d.ts.map +0 -1
- package/lib/types/platform/component.d.ts.map +0 -1
- package/lib/types/platform/datasource.d.ts.map +0 -1
- package/lib/types/platform/eventFlow.d.ts.map +0 -1
- package/lib/types/platform/query.d.ts.map +0 -1
- package/lib/types/platform/theme.d.ts.map +0 -1
- package/lib/utils/CSSProperty.d.ts.map +0 -1
- package/lib/utils/color-generator/core.d.ts.map +0 -1
- package/lib/utils/color-generator/generate.d.ts.map +0 -1
- package/lib/utils/color-generator/utils.d.ts.map +0 -1
- package/lib/utils/constant.d.ts.map +0 -1
- package/lib/utils/dts/auto-generated.d.ts.map +0 -1
- package/lib/utils/dts/index.d.ts.map +0 -1
- package/lib/utils/index.d.ts.map +0 -1
- package/lib/utils/version/common.d.ts.map +0 -1
- package/lib/utils/version/featureChecker.d.ts.map +0 -1
- package/lib/utils/version/migrations/version4.d.ts.map +0 -1
- /package/lib/{parser → cjs/parser}/cals/index.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/get-component-namespace.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/get-component-namespace.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-dataset.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-dataset.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-listeners.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-listeners.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-resources.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-resources.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/remap-component-ids.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-code.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-code.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-expr.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-expr.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-resource.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-resource.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/resolve-new-id.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/resolve-new-id.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/index.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/block/index.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/code/index.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/code/index.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/common.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/getUsedReference.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/getUsedReference.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/getUsedResources.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/getUsedResources.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/runtime.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/runtime.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/spinoff/index.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/spinoff/index.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/style.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/style.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/template.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/template.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/version/common.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/version/common.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/version/config.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/version/config.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/version/index.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/version/index.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/version/parses.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/version/parses.js +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/version/utils.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/cals/utils/version/utils.js +0 -0
- /package/lib/{parser → cjs/parser}/dependiencies/index.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/dependiencies/index.js +0 -0
- /package/lib/{parser → cjs/parser}/expression/index.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/expression/index.js +0 -0
- /package/lib/{parser → cjs/parser}/index.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/index.js +0 -0
- /package/lib/{parser → cjs/parser}/plugins/postcss-rpx2clac.d.ts +0 -0
- /package/lib/{parser → cjs/parser}/plugins/postcss-rpx2clac.js +0 -0
- /package/lib/{types → cjs/types}/basic/app.d.ts +0 -0
- /package/lib/{types → cjs/types}/basic/app.js +0 -0
- /package/lib/{types → cjs/types}/basic/common.d.ts +0 -0
- /package/lib/{types → cjs/types}/basic/common.js +0 -0
- /package/lib/{types → cjs/types}/basic/component.d.ts +0 -0
- /package/lib/{types → cjs/types}/basic/component.js +0 -0
- /package/lib/{types → cjs/types}/basic/datasource.d.ts +0 -0
- /package/lib/{types → cjs/types}/basic/datasource.js +0 -0
- /package/lib/{types → cjs/types}/index.d.ts +0 -0
- /package/lib/{types → cjs/types}/index.js +0 -0
- /package/lib/{types → cjs/types}/lcds.js +0 -0
- /package/lib/{types → cjs/types}/platform/app.js +0 -0
- /package/lib/{types → cjs/types}/platform/common.d.ts +0 -0
- /package/lib/{types → cjs/types}/platform/common.js +0 -0
- /package/lib/{types → cjs/types}/platform/component.js +0 -0
- /package/lib/{types → cjs/types}/platform/datasource.js +0 -0
- /package/lib/{types → cjs/types}/platform/eventFlow.d.ts +0 -0
- /package/lib/{types → cjs/types}/platform/eventFlow.js +0 -0
- /package/lib/{types → cjs/types}/platform/query.d.ts +0 -0
- /package/lib/{types → cjs/types}/platform/query.js +0 -0
- /package/lib/{types → cjs/types}/platform/theme.js +0 -0
- /package/lib/{utils → cjs/utils}/CSSProperty.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/CSSProperty.js +0 -0
- /package/lib/{utils → cjs/utils}/color-generator/core.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/color-generator/core.js +0 -0
- /package/lib/{utils → cjs/utils}/color-generator/generate.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/color-generator/generate.js +0 -0
- /package/lib/{utils → cjs/utils}/color-generator/utils.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/color-generator/utils.js +0 -0
- /package/lib/{utils → cjs/utils}/constant.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/constant.js +0 -0
- /package/lib/{utils → cjs/utils}/dts/auto-generated.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/dts/auto-generated.js +0 -0
- /package/lib/{utils → cjs/utils}/dts/build.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/dts/build.js +0 -0
- /package/lib/{utils → cjs/utils}/dts/index.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/dts/index.js +0 -0
- /package/lib/{utils → cjs/utils}/index.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/index.js +0 -0
- /package/lib/{utils → cjs/utils}/version/common.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/version/common.js +0 -0
- /package/lib/{utils → cjs/utils}/version/featureChecker.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/version/featureChecker.js +0 -0
- /package/lib/{utils → cjs/utils}/version/migrations/version4.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/version/migrations/version4.js +0 -0
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15
|
+
};
|
|
16
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
17
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
18
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
19
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
|
+
};
|
|
21
|
+
var _Dependencies_instances, _Dependencies_schema, _Dependencies_request, _Dependencies_cals, _Dependencies_compositeGroupId, _Dependencies_compositeComponentId, _Dependencies_options, _Dependencies_actualUsedDependencies, _Dependencies_resolveComposititeComponentData;
|
|
22
|
+
// import { CompositeGroupList, SharedCompositeGroupList } from './mock';
|
|
23
|
+
import { ActionType, OFFICIAL_COMPONENT_LIB_NAME, OFFICIAL_LIBS, SPINOFF_SUFFIX, processDependenciesVersionMap, WEDA_OFFICIAL_NAMESPACE, SEMVER_VERSION_TAG, WEDA_COMP_DEPENDENCIES_PREFIX, semverComp, } from '../../utils';
|
|
24
|
+
const X_RUNTIME_DEFAULT = 'x-runtime-default';
|
|
25
|
+
// import { CONST_COMPONENT_MAP } from 'const/component';
|
|
26
|
+
const CONST_COMPONENT_MAP = {};
|
|
27
|
+
const COMPONENT_META_MAP = {};
|
|
28
|
+
const isSemver = (version) => {
|
|
29
|
+
const SERVEM_REG = /^([0-9])+\.([0-9]+)\.([0-9]+)$/;
|
|
30
|
+
return version.match(SERVEM_REG);
|
|
31
|
+
};
|
|
32
|
+
export class Dependencies {
|
|
33
|
+
constructor({ request = {}, cals, compositeGroupId, compositeComponentId, }, options = {}) {
|
|
34
|
+
_Dependencies_instances.add(this);
|
|
35
|
+
_Dependencies_schema.set(this, []);
|
|
36
|
+
_Dependencies_request.set(this, void 0);
|
|
37
|
+
_Dependencies_cals.set(this, void 0);
|
|
38
|
+
_Dependencies_compositeGroupId.set(this, void 0);
|
|
39
|
+
_Dependencies_compositeComponentId.set(this, void 0);
|
|
40
|
+
_Dependencies_options.set(this, void 0);
|
|
41
|
+
_Dependencies_actualUsedDependencies.set(this, void 0);
|
|
42
|
+
__classPrivateFieldSet(this, _Dependencies_cals, cals, "f");
|
|
43
|
+
__classPrivateFieldSet(this, _Dependencies_compositeGroupId, compositeGroupId, "f");
|
|
44
|
+
__classPrivateFieldSet(this, _Dependencies_compositeComponentId, compositeComponentId, "f");
|
|
45
|
+
__classPrivateFieldSet(this, _Dependencies_request, request || {}, "f");
|
|
46
|
+
__classPrivateFieldSet(this, _Dependencies_options, options, "f");
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
static diffDependencies(source, target, whiteList = []) {
|
|
50
|
+
const diff = {};
|
|
51
|
+
const rollbackDiff = {};
|
|
52
|
+
const sourceMap = processDependenciesVersionMap(source);
|
|
53
|
+
const targetMap = processDependenciesVersionMap(target);
|
|
54
|
+
whiteList === null || whiteList === void 0 ? void 0 : whiteList.forEach((libKey) => {
|
|
55
|
+
const current = sourceMap[`${WEDA_OFFICIAL_NAMESPACE}${libKey}`] || sourceMap[libKey];
|
|
56
|
+
const target = targetMap[`${WEDA_OFFICIAL_NAMESPACE}${libKey}`] || targetMap[libKey];
|
|
57
|
+
if (current && target && isSemver(current) && isSemver(target)) {
|
|
58
|
+
if (semverComp(target, current) > 0) {
|
|
59
|
+
// 只有当版本号都是sēmver格式的时候才进行对比并根据策略提示升级否则直接升级
|
|
60
|
+
if (!isMajorVersionEqual(current, target)) {
|
|
61
|
+
diff[libKey] = SEMVER_VERSION_TAG.MAJOR;
|
|
62
|
+
}
|
|
63
|
+
else if (!isMinorVersionEqual(current, target)) {
|
|
64
|
+
diff[libKey] = SEMVER_VERSION_TAG.MINOR;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if (semverComp(current, target) > 0) {
|
|
68
|
+
// 降级的时候,判断如果拉取最新的gsd-h5-react组件版本的中版本号低于当前组件版本,不自动降级
|
|
69
|
+
if (!isMajorVersionEqual(current, target)) {
|
|
70
|
+
rollbackDiff[libKey] = SEMVER_VERSION_TAG.MAJOR;
|
|
71
|
+
}
|
|
72
|
+
else if (!isMinorVersionEqual(current, target)) {
|
|
73
|
+
rollbackDiff[libKey] = SEMVER_VERSION_TAG.MINOR;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return { diff, rollbackDiff };
|
|
79
|
+
}
|
|
80
|
+
static normalizeDependencies(dependencies) {
|
|
81
|
+
const prefixDep = {};
|
|
82
|
+
Object.keys(dependencies).forEach((key) => {
|
|
83
|
+
const value = dependencies[key].indexOf(`${WEDA_COMP_DEPENDENCIES_PREFIX}`) === 0
|
|
84
|
+
? dependencies[key]
|
|
85
|
+
: `${WEDA_COMP_DEPENDENCIES_PREFIX}?v=${dependencies[key]}`;
|
|
86
|
+
// 如果是官方组件库并且没有前缀
|
|
87
|
+
if (OFFICIAL_LIBS.indexOf(key) > -1 && key.indexOf(WEDA_OFFICIAL_NAMESPACE) === -1) {
|
|
88
|
+
prefixDep[`${WEDA_OFFICIAL_NAMESPACE}${key}`] = value;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
prefixDep[key] = value;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return prefixDep;
|
|
95
|
+
}
|
|
96
|
+
static loadProdMaterial({ name: materialName, title, controlJsPath, controlCssPath, components: materialComponents, isComposite = false,
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
justRelyOn = false, // 不进行显示,仅仅是可显示的组件库的依赖库
|
|
99
|
+
}, options) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
try {
|
|
102
|
+
if (!isComposite) {
|
|
103
|
+
// 普通组件
|
|
104
|
+
const [{ lcds, components, plugins, actions }] = yield Promise.all([
|
|
105
|
+
loadProdMetaScript(materialName, controlJsPath),
|
|
106
|
+
loadProdMetaStyle(materialName, controlCssPath),
|
|
107
|
+
]);
|
|
108
|
+
return handleLcdsCompPluginsActions({
|
|
109
|
+
materialName,
|
|
110
|
+
lcds,
|
|
111
|
+
components,
|
|
112
|
+
plugins,
|
|
113
|
+
title,
|
|
114
|
+
actions,
|
|
115
|
+
materialComponents,
|
|
116
|
+
});
|
|
117
|
+
} // 组合组件
|
|
118
|
+
let components = materialComponents.map((cItem) => {
|
|
119
|
+
const result = Object.assign(Object.assign({}, cItem), { sourceKey: `${materialName}:${cItem.name}`, materialName, name: cItem.name || cItem.meta.title, title,
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
meta: Object.assign(Object.assign({}, cItem.meta), { inputProps: extractInputProps(cItem.dataForm) }), justRelyOn });
|
|
122
|
+
// @ts-ignore
|
|
123
|
+
// handleComponent(result);
|
|
124
|
+
return result;
|
|
125
|
+
});
|
|
126
|
+
// 如果是复合组件编辑器,过滤掉本身正在编辑的组件(即当前不支持嵌套)
|
|
127
|
+
components = components.filter((item) => `${item.id}` !== (options === null || options === void 0 ? void 0 : options.compositeComponentId));
|
|
128
|
+
// compositeComponentsMap[materialName] = components;
|
|
129
|
+
const ret = { components, plugins: [], actions: [], name: materialName, title };
|
|
130
|
+
return ret;
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
return { materialName, title, error: typeof e === 'string' ? e : e.message || '', components: [] };
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 处理 component schema
|
|
139
|
+
* 用于补充设计态相关字段
|
|
140
|
+
*/
|
|
141
|
+
processCompnent(component) {
|
|
142
|
+
/**
|
|
143
|
+
* 如果组件层级中有 `x-runtime-default` 字段,取其值自动设置 `default` 字段
|
|
144
|
+
* 函数存在副作用
|
|
145
|
+
* 修改了component 的 item
|
|
146
|
+
*/
|
|
147
|
+
recursiveTraverse(component, (item) => {
|
|
148
|
+
if (typeof item === 'object' && item && X_RUNTIME_DEFAULT in item && !('default' in item)) {
|
|
149
|
+
item.default = item[X_RUNTIME_DEFAULT];
|
|
150
|
+
// if (!state.meta.hasRuntimeDefault) {
|
|
151
|
+
// state.meta.hasRuntimeDefault = true;
|
|
152
|
+
// }
|
|
153
|
+
}
|
|
154
|
+
else if (typeof item === 'object' && item && item['x-component'] === 'page-params') {
|
|
155
|
+
item.items = {
|
|
156
|
+
type: 'object',
|
|
157
|
+
properties: {
|
|
158
|
+
key: {
|
|
159
|
+
type: 'string',
|
|
160
|
+
title: '参数名',
|
|
161
|
+
},
|
|
162
|
+
value: {
|
|
163
|
+
type: 'string',
|
|
164
|
+
title: '参数值',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
item['x-title-help'] = "参数绑定格式:```[{key:'参数名',value:'参数值'}]```";
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
if (COMPONENT_META_MAP[component.sourceKey] && component.meta && /[a-zA-Z]/.test(component.meta.title)) {
|
|
172
|
+
component.meta = Object.assign(Object.assign({}, component.meta), COMPONENT_META_MAP[component.sourceKey]);
|
|
173
|
+
}
|
|
174
|
+
return component;
|
|
175
|
+
}
|
|
176
|
+
useLatestDependiencies(latestCompositeGroupList) {
|
|
177
|
+
var _a, _b;
|
|
178
|
+
return ((_b = (_a = __classPrivateFieldGet(this, _Dependencies_options, "f")).useLatestDependiencies) === null || _b === void 0 ? void 0 : _b.call(_a, latestCompositeGroupList)) || false;
|
|
179
|
+
}
|
|
180
|
+
onCalsDependenciesChange(dependencies) {
|
|
181
|
+
var _a, _b;
|
|
182
|
+
return (_b = (_a = __classPrivateFieldGet(this, _Dependencies_options, "f")).onCalsDependenciesChange) === null || _b === void 0 ? void 0 : _b.call(_a, dependencies);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* 核心逻辑。获取组件物料,主要做了以下事情:
|
|
186
|
+
* 1、加载组件库最新列表
|
|
187
|
+
* 2、用户组件库立刻加载
|
|
188
|
+
* 2、官方组件库不加载
|
|
189
|
+
*/
|
|
190
|
+
init() {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
/**
|
|
193
|
+
* 1. 获取最新的组件库
|
|
194
|
+
*/
|
|
195
|
+
const { Data } = yield this.DescribeLatestCompositeGroupList({ WeAppId: __classPrivateFieldGet(this, _Dependencies_cals, "f").id });
|
|
196
|
+
const { List: latestCompositeGroupList = [] } = Data;
|
|
197
|
+
const OFFICIAL_LIB_SET = new Set(OFFICIAL_LIBS);
|
|
198
|
+
const dependenciesVersionMap = processDependenciesVersionMap(Object.assign({}, __classPrivateFieldGet(this, _Dependencies_cals, "f").dependencies));
|
|
199
|
+
// 2、根据对比结果,获取对应组件库的组件
|
|
200
|
+
let compositeGroupList = [];
|
|
201
|
+
if (!this.useLatestDependiencies(latestCompositeGroupList)) {
|
|
202
|
+
// a.如果存在任意一个官方组件库不同,则加载应用的版本
|
|
203
|
+
// b.如果拉取最新的gsd-h5-react组件版本的中版本号低于当前组件版本,则加载应用版本
|
|
204
|
+
const officialCompositeGroupMeta = [];
|
|
205
|
+
const officialCompositeGroupMetaList = [];
|
|
206
|
+
latestCompositeGroupList.forEach((compositeGroup) => {
|
|
207
|
+
const version = dependenciesVersionMap[`${WEDA_OFFICIAL_NAMESPACE}${compositeGroup.GroupName}`] ||
|
|
208
|
+
dependenciesVersionMap[compositeGroup.GroupName];
|
|
209
|
+
if (OFFICIAL_LIB_SET.has(compositeGroup.GroupName)) {
|
|
210
|
+
if (version) {
|
|
211
|
+
officialCompositeGroupMeta.push({ Id: compositeGroup.Id, GroupVersion: version });
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
officialCompositeGroupMetaList.push(compositeGroup);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
compositeGroupList.push(compositeGroup);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
if (officialCompositeGroupMeta.length) {
|
|
222
|
+
const { Data: { List = [] }, } = yield this.DescribeCompositeGroupList({ GroupList: officialCompositeGroupMeta });
|
|
223
|
+
officialCompositeGroupMetaList.push(...List);
|
|
224
|
+
}
|
|
225
|
+
if (!__classPrivateFieldGet(this, _Dependencies_options, "f").autoUpgradeToLatestPatchVersion) {
|
|
226
|
+
compositeGroupList.push(...officialCompositeGroupMetaList);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
const patchGroupMeta = [];
|
|
230
|
+
officialCompositeGroupMetaList.forEach((compGroup) => {
|
|
231
|
+
if (
|
|
232
|
+
// 有tinyPrimeVersion 并且 tinyPrimeVersion 不等于当前版本
|
|
233
|
+
typeof compGroup.TinyPrimeVersion === 'string' &&
|
|
234
|
+
compGroup.TinyPrimeVersion.length > 0 &&
|
|
235
|
+
compGroup.TinyPrimeVersion !== compGroup.Version) {
|
|
236
|
+
// 收集需要 patch 的版本
|
|
237
|
+
patchGroupMeta.push({ Id: compGroup.Id, GroupVersion: compGroup.TinyPrimeVersion });
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
// 无需 path 直接使用查找的数据不重复查询
|
|
241
|
+
compositeGroupList.push(compGroup);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
if (patchGroupMeta.length) {
|
|
245
|
+
const { Data: { List: patchGroupList = [] }, } = yield this.DescribeCompositeGroupList({ GroupList: patchGroupMeta });
|
|
246
|
+
compositeGroupList.push(...patchGroupList);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
compositeGroupList = latestCompositeGroupList;
|
|
252
|
+
}
|
|
253
|
+
__classPrivateFieldSet(this, _Dependencies_actualUsedDependencies, Dependencies.normalizeDependencies(compositeGroupList.reduce((acc, cur) => {
|
|
254
|
+
acc[cur.GroupName] = cur.Version;
|
|
255
|
+
return acc;
|
|
256
|
+
}, {})), "f");
|
|
257
|
+
this.onCalsDependenciesChange(__classPrivateFieldGet(this, _Dependencies_actualUsedDependencies, "f"));
|
|
258
|
+
let materials = yield __classPrivateFieldGet(this, _Dependencies_instances, "m", _Dependencies_resolveComposititeComponentData).call(this, __classPrivateFieldGet(this, _Dependencies_cals, "f").id, compositeGroupList, {
|
|
259
|
+
compositeGroupId: __classPrivateFieldGet(this, _Dependencies_compositeGroupId, "f"),
|
|
260
|
+
});
|
|
261
|
+
/**
|
|
262
|
+
* 3、兜底逻辑,获取 gsd-h5-react
|
|
263
|
+
* @deprecated
|
|
264
|
+
*/
|
|
265
|
+
// if (!materials.find((m) => m.name === OFFICIAL_MATERIAL_LIB_NAME)) {
|
|
266
|
+
// const { materialErr, materialData } = await getOffcialMaterial();
|
|
267
|
+
// if (materialErr) {
|
|
268
|
+
// materialErr.message = `[listMaterials]${parseRequestErrorMessage(materialErr)}`;
|
|
269
|
+
// dispatch.common.updateLoadStatus({ materialDataLoadError: materialErr || new Error('无组件库加载成功') });
|
|
270
|
+
// return;
|
|
271
|
+
// }
|
|
272
|
+
// materials.push(...materialData);
|
|
273
|
+
// }
|
|
274
|
+
// 4、转换数据格式,铺平所有组件
|
|
275
|
+
const prodMaterialResult = yield Promise.all(materials.map((info) => Dependencies.loadProdMaterial(info, { compositeComponentId: __classPrivateFieldGet(this, _Dependencies_compositeComponentId, "f") })));
|
|
276
|
+
const materialResult = _getMaterialData(materials, prodMaterialResult, this.processCompnent);
|
|
277
|
+
__classPrivateFieldSet(this, _Dependencies_schema, materialResult.dependencies || [], "f");
|
|
278
|
+
return materialResult;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
DescribeLatestCompositeGroupList({ WeAppId }) {
|
|
282
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
+
const [{ Data: { List: compositeGroup = [] }, }, { Data: { List: sharedCompositeGroup = [] }, },] = yield Promise.all([
|
|
284
|
+
this.DescribeCompositeGroupList({ WeAppId }),
|
|
285
|
+
this.DescribeShareCompGroups({ WeAppId }).catch((e) => {
|
|
286
|
+
return {
|
|
287
|
+
Data: { Count: 0, List: [] },
|
|
288
|
+
};
|
|
289
|
+
}),
|
|
290
|
+
]);
|
|
291
|
+
const COMPOSITE_MAP = compositeGroup.reduce((map, item) => {
|
|
292
|
+
map[item.GroupName] = true;
|
|
293
|
+
return map;
|
|
294
|
+
}, {});
|
|
295
|
+
sharedCompositeGroup.forEach((item) => {
|
|
296
|
+
if (item.GroupName && !COMPOSITE_MAP[item.GroupName]) {
|
|
297
|
+
compositeGroup.push(item);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
return { Data: { List: compositeGroup } };
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
get schema() {
|
|
304
|
+
return __classPrivateFieldGet(this, _Dependencies_schema, "f");
|
|
305
|
+
}
|
|
306
|
+
DescribeCompositeGroupList(data, opts = undefined) {
|
|
307
|
+
var _a;
|
|
308
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
309
|
+
if ((_a = __classPrivateFieldGet(this, _Dependencies_request, "f")) === null || _a === void 0 ? void 0 : _a.DescribeCompositeGroupList) {
|
|
310
|
+
return __classPrivateFieldGet(this, _Dependencies_request, "f").DescribeCompositeGroupList(data, opts);
|
|
311
|
+
}
|
|
312
|
+
throw new Error('need to impl DescribeCompositeGroupList');
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
DescribeShareCompGroups(data) {
|
|
316
|
+
var _a;
|
|
317
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
318
|
+
if ((_a = __classPrivateFieldGet(this, _Dependencies_request, "f")) === null || _a === void 0 ? void 0 : _a.DescribeShareCompGroups) {
|
|
319
|
+
return __classPrivateFieldGet(this, _Dependencies_request, "f").DescribeShareCompGroups(data);
|
|
320
|
+
}
|
|
321
|
+
throw new Error('need to impl DescribeShareCompGroups');
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
DescribeCompositeContent(data) {
|
|
325
|
+
var _a;
|
|
326
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
327
|
+
if ((_a = __classPrivateFieldGet(this, _Dependencies_request, "f")) === null || _a === void 0 ? void 0 : _a.DescribeCompositeContent) {
|
|
328
|
+
return __classPrivateFieldGet(this, _Dependencies_request, "f").DescribeCompositeContent(data);
|
|
329
|
+
}
|
|
330
|
+
throw new Error('need to impl DescribeCompositeContent');
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
_Dependencies_schema = new WeakMap(), _Dependencies_request = new WeakMap(), _Dependencies_cals = new WeakMap(), _Dependencies_compositeGroupId = new WeakMap(), _Dependencies_compositeComponentId = new WeakMap(), _Dependencies_options = new WeakMap(), _Dependencies_actualUsedDependencies = new WeakMap(), _Dependencies_instances = new WeakSet(), _Dependencies_resolveComposititeComponentData = function _Dependencies_resolveComposititeComponentData(appId, componentGroups, options) {
|
|
335
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
336
|
+
const { compositeGroupId } = options || {};
|
|
337
|
+
const compData = [];
|
|
338
|
+
yield Promise.all(componentGroups.map((group) => __awaiter(this, void 0, void 0, function* () {
|
|
339
|
+
// compositeGroup/list 只能获取到发布prod情况下的组件库信息
|
|
340
|
+
const { Id: id, Title, GroupName: groupName, Version: version, Content, PrivateCosPrefix: privateCosPrefix, PublicCosPrefix: publicCosPrefix, IsShare, } = group;
|
|
341
|
+
const obj = {
|
|
342
|
+
id,
|
|
343
|
+
version,
|
|
344
|
+
originName: groupName,
|
|
345
|
+
name: groupName,
|
|
346
|
+
title: Title || groupName,
|
|
347
|
+
components: [],
|
|
348
|
+
isComposite: true,
|
|
349
|
+
content: Content ? JSON.parse(Content) : undefined,
|
|
350
|
+
publicCosPrefix,
|
|
351
|
+
privateCosPrefix,
|
|
352
|
+
};
|
|
353
|
+
// 获取复合组件库的组件列表
|
|
354
|
+
// dev=true代表获取未发布的组件详情
|
|
355
|
+
// 目前支持在组件编辑器中,调试同一个库里的未发布的组件
|
|
356
|
+
// 官方组件库,在组件编辑器里,直接拉取线上,方便刷库@zijie
|
|
357
|
+
const dev = groupName === OFFICIAL_COMPONENT_LIB_NAME ? false : compositeGroupId === obj.id;
|
|
358
|
+
let data;
|
|
359
|
+
try {
|
|
360
|
+
data = yield this.DescribeCompositeContent({
|
|
361
|
+
CompositeGroupId: obj.id,
|
|
362
|
+
WeAppId: appId,
|
|
363
|
+
Version: version,
|
|
364
|
+
IsShare,
|
|
365
|
+
Dev: dev,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
catch (e) { }
|
|
369
|
+
if (data === null || data === void 0 ? void 0 : data.Count) {
|
|
370
|
+
let isMixed = false;
|
|
371
|
+
let newContent = data.Content || obj.content;
|
|
372
|
+
const newPublicCosPrefix = data.PublicCosPrefix || publicCosPrefix;
|
|
373
|
+
const newPrivateCosPrefix = data.PrivateCosPrefix || privateCosPrefix;
|
|
374
|
+
// 在组件编辑器,可以获取到同一个库的未发布即dev的组件
|
|
375
|
+
// 利用compositeComp/list 更新相关信息
|
|
376
|
+
Object.assign(obj, {
|
|
377
|
+
content: newContent,
|
|
378
|
+
publicCosPrefix: newPublicCosPrefix,
|
|
379
|
+
privateCosPrefix: newPrivateCosPrefix,
|
|
380
|
+
mainCssPath: `${newPublicCosPrefix}build/dist/comps.complex.main.css`,
|
|
381
|
+
mainJsPath: `${newPublicCosPrefix}build/dist/comps.complex.main.js`,
|
|
382
|
+
});
|
|
383
|
+
if (!newContent) {
|
|
384
|
+
// 纯JSON组件库,不需要进行分拆
|
|
385
|
+
obj.components = data.Components;
|
|
386
|
+
if (id === 'cg-jgjmnsvid6ot' && version === '1612432272646') {
|
|
387
|
+
const find = {};
|
|
388
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
389
|
+
for (const index in obj.components) {
|
|
390
|
+
if (!isNaN(Number(index))) {
|
|
391
|
+
const { name, groupName } = obj.components[Number(index)];
|
|
392
|
+
const sourceKey = `${groupName}:${name}`;
|
|
393
|
+
switch (sourceKey) {
|
|
394
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:FormRegion`:
|
|
395
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:GridLayout`: {
|
|
396
|
+
if (CONST_COMPONENT_MAP[sourceKey]) {
|
|
397
|
+
obj.components[index] = CONST_COMPONENT_MAP[sourceKey];
|
|
398
|
+
find[sourceKey] = true;
|
|
399
|
+
}
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:TabBarItem`:
|
|
403
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:Media`:
|
|
404
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:Icon`:
|
|
405
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:SlotMachine`:
|
|
406
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:Form`:
|
|
407
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:FormItem`:
|
|
408
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:FormDate`:
|
|
409
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:ItemList`:
|
|
410
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:Item`:
|
|
411
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:TabBar`:
|
|
412
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:NavBar`:
|
|
413
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:FormSelect`:
|
|
414
|
+
case `${OFFICIAL_COMPONENT_LIB_NAME}:Classification`: {
|
|
415
|
+
if (CONST_COMPONENT_MAP[sourceKey]) {
|
|
416
|
+
obj.components[index] = CONST_COMPONENT_MAP[sourceKey];
|
|
417
|
+
}
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
if (!find[`${OFFICIAL_COMPONENT_LIB_NAME}:GridLayout`] &&
|
|
424
|
+
CONST_COMPONENT_MAP[`${OFFICIAL_COMPONENT_LIB_NAME}:GridLayout`]) {
|
|
425
|
+
obj.components.push(CONST_COMPONENT_MAP[`${OFFICIAL_COMPONENT_LIB_NAME}:GridLayout`]);
|
|
426
|
+
}
|
|
427
|
+
if (!find[`${OFFICIAL_COMPONENT_LIB_NAME}:FormRegion`] &&
|
|
428
|
+
CONST_COMPONENT_MAP[`${OFFICIAL_COMPONENT_LIB_NAME}:FormRegion`]) {
|
|
429
|
+
obj.components.push(CONST_COMPONENT_MAP[`${OFFICIAL_COMPONENT_LIB_NAME}:FormRegion`]);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
// 纯json库也需要加上 分库的后缀,官方组件库除外
|
|
433
|
+
![OFFICIAL_COMPONENT_LIB_NAME, 'weda_standard'].includes(groupName) && (obj.name += SPINOFF_SUFFIX);
|
|
434
|
+
compData.push(obj);
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
// 新版组件库,控制台入口是打平code和json组件,在编辑器runtime和builder
|
|
438
|
+
// 需要拆分成json和code,适配之前的模式;
|
|
439
|
+
const codeComp = [];
|
|
440
|
+
const jsonComp = [];
|
|
441
|
+
const { actions, manifestMap, sourceMap } = newContent;
|
|
442
|
+
const { controlJs, mainCss, mainJs } = manifestMap;
|
|
443
|
+
const { source, mpSource } = sourceMap;
|
|
444
|
+
const controlJsPath = newPublicCosPrefix + controlJs;
|
|
445
|
+
const mainCssPath = newPublicCosPrefix + mainCss;
|
|
446
|
+
const mainJsPath = newPublicCosPrefix + mainJs;
|
|
447
|
+
const mpPkgUrl = mpSource && newPrivateCosPrefix + mpSource;
|
|
448
|
+
const sourceZipPath = newPrivateCosPrefix + source;
|
|
449
|
+
const codeLibObj = Object.assign({}, obj, {
|
|
450
|
+
actions,
|
|
451
|
+
isComposite: false,
|
|
452
|
+
controlJsPath,
|
|
453
|
+
mainCssPath,
|
|
454
|
+
mainJsPath,
|
|
455
|
+
mpPkgUrl,
|
|
456
|
+
sourceZipPath,
|
|
457
|
+
});
|
|
458
|
+
// 组件库里有json组件和code组件,需要分拆两个库
|
|
459
|
+
data.Components.forEach((comp) => {
|
|
460
|
+
if (comp.ctype === 1) {
|
|
461
|
+
// code 组件
|
|
462
|
+
codeComp.push(comp);
|
|
463
|
+
}
|
|
464
|
+
else if (comp.ctype === 2) {
|
|
465
|
+
// json 组件
|
|
466
|
+
jsonComp.push(comp);
|
|
467
|
+
isMixed = true;
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
obj.components = jsonComp;
|
|
471
|
+
isMixed && (obj.name += SPINOFF_SUFFIX);
|
|
472
|
+
codeLibObj.components = codeComp;
|
|
473
|
+
compData.push(codeLibObj);
|
|
474
|
+
if (jsonComp.length > 0) {
|
|
475
|
+
compData.push(Object.assign(Object.assign({}, obj), { mainCssPath: `${newPublicCosPrefix}build/dist/comps.complex.main.css`, mainJsPath: `${newPublicCosPrefix}build/dist/comps.complex.main.js` }));
|
|
476
|
+
obj.components = jsonComp;
|
|
477
|
+
isMixed && (obj.name += SPINOFF_SUFFIX);
|
|
478
|
+
codeLibObj.components = codeComp;
|
|
479
|
+
compData.push(codeLibObj);
|
|
480
|
+
if (jsonComp.length > 0) {
|
|
481
|
+
compData.push(Object.assign(Object.assign({}, obj), { mainCssPath: `${newPublicCosPrefix}build/dist/comps.complex.main.css`, mainJsPath: `${newPublicCosPrefix}build/dist/comps.complex.main.js` }));
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
})));
|
|
487
|
+
return compData;
|
|
488
|
+
});
|
|
489
|
+
};
|
|
490
|
+
function loadProdMetaScript(bundleName, filename) {
|
|
491
|
+
return new Promise((resolve, reject) => {
|
|
492
|
+
const script = document.createElement('script');
|
|
493
|
+
script.setAttribute('src', filename);
|
|
494
|
+
script.setAttribute('class', '@weapps-materials-control');
|
|
495
|
+
script.addEventListener('load', () => {
|
|
496
|
+
const moduleName = `@weapps-materials-control-${bundleName}`;
|
|
497
|
+
if (Object.prototype.hasOwnProperty.call(window, moduleName)) {
|
|
498
|
+
const value = window[moduleName];
|
|
499
|
+
return resolve(value);
|
|
500
|
+
}
|
|
501
|
+
return reject(new Error(`meta bundle [${bundleName}] must build with UMD`));
|
|
502
|
+
});
|
|
503
|
+
script.addEventListener('error', (e) => reject(`meta bundle [${bundleName}] load failed: ${(e === null || e === void 0 ? void 0 : e.message) || ''}`));
|
|
504
|
+
document.body.appendChild(script);
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
function loadProdMetaStyle(bundleName, filename, entryDoc = document, isLess = false) {
|
|
508
|
+
if (!filename) {
|
|
509
|
+
return Promise.resolve();
|
|
510
|
+
}
|
|
511
|
+
return new Promise((resolve) => {
|
|
512
|
+
const link = document.createElement('link');
|
|
513
|
+
link.type = 'text/css';
|
|
514
|
+
link.rel = isLess ? 'stylesheet/less' : 'stylesheet';
|
|
515
|
+
link.className = '@weapps-materials-style';
|
|
516
|
+
link.href = filename;
|
|
517
|
+
link.addEventListener('load', () => resolve());
|
|
518
|
+
link.addEventListener('error', (e) => {
|
|
519
|
+
console.warn(`Load [${bundleName}] meta style failed, skip...`, e);
|
|
520
|
+
resolve();
|
|
521
|
+
});
|
|
522
|
+
entryDoc.head.appendChild(link);
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
function handleLcdsCompPluginsActions({ materialName, lcds, components, plugins, actions, title, materialComponents = null, }) {
|
|
526
|
+
components.forEach((i) => {
|
|
527
|
+
var _a;
|
|
528
|
+
i.sourceKey = `${materialName}:${i.name}`;
|
|
529
|
+
i.materialName = materialName;
|
|
530
|
+
const { icon, description } = i.meta;
|
|
531
|
+
if (materialComponents) {
|
|
532
|
+
const { platform } = i.meta;
|
|
533
|
+
i.meta = Object.assign(Object.assign(Object.assign({}, i.meta), (((_a = materialComponents.find((c) => c.name === i.name)) === null || _a === void 0 ? void 0 : _a.meta) || {})), { description });
|
|
534
|
+
i.meta.platform = platform ? platform : i.meta.platform;
|
|
535
|
+
i.meta.platform = i.meta.platform || [];
|
|
536
|
+
}
|
|
537
|
+
if (icon === null || icon === void 0 ? void 0 : icon.startsWith('data:')) {
|
|
538
|
+
i.meta.icon = icon;
|
|
539
|
+
}
|
|
540
|
+
// handleComponent(i);
|
|
541
|
+
});
|
|
542
|
+
plugins.forEach((i) => {
|
|
543
|
+
i.sourceKey = `${materialName}:${i.name}`;
|
|
544
|
+
i.materialName = materialName;
|
|
545
|
+
});
|
|
546
|
+
actions.forEach((i) => {
|
|
547
|
+
i.sourceKey = `${materialName}:${i.name}`;
|
|
548
|
+
i.materialName = materialName;
|
|
549
|
+
i.type = ActionType.Material;
|
|
550
|
+
});
|
|
551
|
+
return { lcds, components, plugins, actions, title, name: materialName };
|
|
552
|
+
}
|
|
553
|
+
function _getMaterialData(materials, prodMaterialResult, processCompnent) {
|
|
554
|
+
var _a;
|
|
555
|
+
const componentMethodList = {};
|
|
556
|
+
let { successMaterialList: finalMaterialList } = prodMaterialResult.reduce((acc, item) => {
|
|
557
|
+
if (!item.error) {
|
|
558
|
+
acc.successMaterialList.push(item);
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
console.log('pull prod material error:', item.error);
|
|
562
|
+
}
|
|
563
|
+
return acc;
|
|
564
|
+
}, {
|
|
565
|
+
successMaterialList: [],
|
|
566
|
+
});
|
|
567
|
+
finalMaterialList = finalMaterialList.map((lib) => {
|
|
568
|
+
lib.components = lib.components.map((comp) => {
|
|
569
|
+
var _a;
|
|
570
|
+
/**
|
|
571
|
+
* 副作用修改 component schema 信息
|
|
572
|
+
*/
|
|
573
|
+
comp = processCompnent(comp);
|
|
574
|
+
if (((_a = comp === null || comp === void 0 ? void 0 : comp.methods) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
575
|
+
componentMethodList[comp.sourceKey.toLowerCase()] = comp.methods;
|
|
576
|
+
}
|
|
577
|
+
return comp;
|
|
578
|
+
});
|
|
579
|
+
return lib;
|
|
580
|
+
});
|
|
581
|
+
const components = finalMaterialList.reduce((result, material) => result.concat(material.components), []);
|
|
582
|
+
const componentsMap = {};
|
|
583
|
+
for (const item of materials) {
|
|
584
|
+
componentsMap[item.name] = [];
|
|
585
|
+
}
|
|
586
|
+
for (const item of components) {
|
|
587
|
+
(_a = componentsMap[item.materialName]) === null || _a === void 0 ? void 0 : _a.push(item);
|
|
588
|
+
}
|
|
589
|
+
return {
|
|
590
|
+
lcds: finalMaterialList.lcds,
|
|
591
|
+
compLibs: finalMaterialList.map((item) => {
|
|
592
|
+
return ['desc', 'name', 'title', 'version', 'isComposite'].reduce((map, key) => {
|
|
593
|
+
if (item[key] !== undefined) {
|
|
594
|
+
map[key] = item[key];
|
|
595
|
+
}
|
|
596
|
+
return map;
|
|
597
|
+
}, {});
|
|
598
|
+
}),
|
|
599
|
+
actions: finalMaterialList.reduce((result, material) => result.concat(material.actions), []),
|
|
600
|
+
components,
|
|
601
|
+
plugins: finalMaterialList.reduce((result, material) => result.concat(material.plugins), []),
|
|
602
|
+
componentMethodList,
|
|
603
|
+
dependencies: materials.map((m) => {
|
|
604
|
+
let schemaVersion;
|
|
605
|
+
const find = finalMaterialList.find((item) => item.name === m.name);
|
|
606
|
+
if (find && !m.isComposite) {
|
|
607
|
+
// 基础库补充schemaVersion
|
|
608
|
+
const { lcds = {} } = find;
|
|
609
|
+
if (lcds.schemaVersion) {
|
|
610
|
+
schemaVersion = lcds.schemaVersion;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return {
|
|
614
|
+
schemaVersion,
|
|
615
|
+
name: m.name,
|
|
616
|
+
originName: m.name === m.originName ? undefined : m.originName,
|
|
617
|
+
version: m.version,
|
|
618
|
+
controlJsPath: m.controlJsPath,
|
|
619
|
+
mainCssPath: m.mainCssPath,
|
|
620
|
+
mainJsPath: m.mainJsPath,
|
|
621
|
+
srcZipUrl: m.sourceZipPath,
|
|
622
|
+
mpPkgUrl: m.mpPkgUrl,
|
|
623
|
+
isComposite: !!m.isComposite,
|
|
624
|
+
components: componentsMap[m.name] || [],
|
|
625
|
+
};
|
|
626
|
+
}),
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
function extractInputProps(schema) {
|
|
630
|
+
const inputProps = {};
|
|
631
|
+
Object.keys(schema).map((prop) => {
|
|
632
|
+
if (schema[prop].inputProp) {
|
|
633
|
+
inputProps[prop] = schema[prop].inputProp;
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
return inputProps;
|
|
637
|
+
}
|
|
638
|
+
/** 版本号 major不同才认为是不同
|
|
639
|
+
* @param curVersion 当前版本
|
|
640
|
+
* @param targetVersion 需要对比的版本
|
|
641
|
+
* @returns boolean
|
|
642
|
+
*/
|
|
643
|
+
const isMajorVersionEqual = (curVersion, targetVersion) => {
|
|
644
|
+
const cur = isSemver(curVersion);
|
|
645
|
+
const target = isSemver(targetVersion);
|
|
646
|
+
if (cur && target) {
|
|
647
|
+
return cur[1] === target[1];
|
|
648
|
+
}
|
|
649
|
+
return curVersion === targetVersion;
|
|
650
|
+
};
|
|
651
|
+
/** 版本号 minor不同才认为是不同
|
|
652
|
+
* @param curVersion 当前版本
|
|
653
|
+
* @param targetVersion 需要对比的版本
|
|
654
|
+
* @returns boolean
|
|
655
|
+
*/
|
|
656
|
+
const isMinorVersionEqual = (curVersion, targetVersion) => {
|
|
657
|
+
const cur = isSemver(curVersion);
|
|
658
|
+
const target = isSemver(targetVersion);
|
|
659
|
+
if (cur && target) {
|
|
660
|
+
return cur[1] === target[1] && cur[2] === target[2];
|
|
661
|
+
}
|
|
662
|
+
return curVersion === targetVersion;
|
|
663
|
+
};
|
|
664
|
+
function recursiveTraverse(target, visit) {
|
|
665
|
+
function traverse(obj, path) {
|
|
666
|
+
if (Array.isArray(obj)) {
|
|
667
|
+
for (const [index, item] of obj.entries()) {
|
|
668
|
+
const currPath = path.concat(index);
|
|
669
|
+
traverse(item, currPath);
|
|
670
|
+
visit(item, currPath);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
else if (typeof obj === 'object' && obj !== null) {
|
|
674
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
675
|
+
const currPath = path.concat(key);
|
|
676
|
+
traverse(value, currPath);
|
|
677
|
+
visit(value, currPath);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
traverse(target, []);
|
|
682
|
+
// visit target itself lastly
|
|
683
|
+
visit(target, []);
|
|
684
|
+
}
|