@yahoo/uds-create-config 2.45.0 → 3.0.1
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/README.md +129 -0
- package/dist/ai-lanes.d.ts +23 -0
- package/dist/ai-lanes.js +34 -0
- package/dist/authoring/define-component.d.ts +85 -0
- package/dist/configs/CanvasConfig.d.ts +3237 -0
- package/dist/configs/CanvasConfig.js +332 -0
- package/dist/configs/build-options.d.ts +10 -0
- package/dist/configs/build-options.js +68 -0
- package/dist/configs/platform.d.ts +15 -0
- package/dist/configs/platform.js +17 -0
- package/dist/configs/react-native-system.d.ts +3026 -0
- package/dist/configs/react-native-system.js +64 -0
- package/dist/configs/system.d.ts +2771 -0
- package/dist/configs/system.js +74 -0
- package/dist/css/properties.generated.d.ts +14 -0
- package/dist/css/properties.generated.js +6260 -0
- package/dist/css/value-type.d.ts +48 -0
- package/dist/css/value-type.js +131 -0
- package/dist/css/values.d.ts +33 -0
- package/dist/css/values.js +116 -0
- package/dist/entities/native/NativeModifier.d.ts +25 -0
- package/dist/entities/native/NativeModifier.js +41 -0
- package/dist/entities/native/NativeSettings.d.ts +44 -0
- package/dist/entities/native/NativeSettings.js +39 -0
- package/dist/entities/native/NativeStyleProperty.d.ts +355 -0
- package/dist/entities/native/NativeStyleProperty.js +28 -0
- package/dist/entities/native/NativeToken.d.ts +31 -0
- package/dist/entities/native/NativeToken.js +49 -0
- package/dist/entities/system/CanvasRole.d.ts +34 -0
- package/dist/entities/system/CanvasRole.js +45 -0
- package/dist/entities/system/Component.d.ts +1287 -0
- package/dist/entities/system/Component.js +1840 -0
- package/dist/entities/system/Composite.d.ts +12 -0
- package/dist/entities/system/Composite.js +26 -0
- package/dist/entities/system/Device.d.ts +11 -0
- package/dist/entities/system/Device.js +18 -0
- package/dist/entities/system/File.d.ts +72 -0
- package/dist/entities/system/File.js +136 -0
- package/dist/entities/system/Font.d.ts +48 -0
- package/dist/entities/system/Font.js +56 -0
- package/dist/entities/system/GlobalStyle.d.ts +26 -0
- package/dist/entities/system/GlobalStyle.js +54 -0
- package/dist/entities/system/Guidance.d.ts +85 -0
- package/dist/entities/system/Guidance.js +59 -0
- package/dist/entities/system/GuidanceStyle.d.ts +14 -0
- package/dist/entities/system/GuidanceStyle.js +8 -0
- package/dist/entities/system/Icon.d.ts +46 -0
- package/dist/entities/system/Icon.js +46 -0
- package/dist/entities/system/LinkedSystem.d.ts +504 -0
- package/dist/entities/system/LinkedSystem.js +814 -0
- package/dist/entities/system/Modifier.d.ts +92 -0
- package/dist/entities/system/Modifier.js +120 -0
- package/dist/entities/system/Motion.d.ts +28 -0
- package/dist/entities/system/Motion.js +48 -0
- package/dist/entities/system/Operation.d.ts +100 -0
- package/dist/entities/system/Operation.js +236 -0
- package/dist/entities/system/Package.d.ts +42 -0
- package/dist/entities/system/Package.js +75 -0
- package/dist/entities/system/Settings.d.ts +94 -0
- package/dist/entities/system/Settings.js +166 -0
- package/dist/entities/system/StyleProperty.d.ts +135 -0
- package/dist/entities/system/StyleProperty.js +438 -0
- package/dist/entities/system/Token.d.ts +67 -0
- package/dist/entities/system/Token.js +129 -0
- package/dist/entities/system/Tool.d.ts +134 -0
- package/dist/entities/system/Tool.js +124 -0
- package/dist/entities/system/color.d.ts +64 -0
- package/dist/entities/system/color.js +123 -0
- package/dist/entities/system/component-module.d.ts +63 -0
- package/dist/entities/system/component-module.js +258 -0
- package/dist/entities/system/copy-plan.d.ts +98 -0
- package/dist/entities/system/copy-plan.js +451 -0
- package/dist/entities/system/defineComponent.d.ts +428 -0
- package/dist/entities/system/defineComponent.js +337 -0
- package/dist/entities/system/element.d.ts +101 -0
- package/dist/entities/system/element.js +171 -0
- package/dist/entities/system/icon-library.d.ts +64 -0
- package/dist/entities/system/icon-library.js +112 -0
- package/dist/entities/system/icon-metadata.d.ts +72 -0
- package/dist/entities/system/icon-metadata.js +111 -0
- package/dist/entities/system/link-declaration.d.ts +27 -0
- package/dist/entities/system/link-declaration.js +64 -0
- package/dist/entities/system/link-plan.d.ts +160 -0
- package/dist/entities/system/link-plan.js +770 -0
- package/dist/entities/system/runtime-modules.d.ts +25 -0
- package/dist/entities/system/runtime-modules.js +38 -0
- package/dist/entities/system/style-bag.d.ts +20 -0
- package/dist/entities/system/style-bag.js +246 -0
- package/dist/entities/system/token-index.d.ts +89 -0
- package/dist/entities/system/token-index.js +112 -0
- package/dist/framework/Config.d.ts +2472 -0
- package/dist/framework/Config.js +5023 -0
- package/dist/framework/Entity.d.ts +127 -0
- package/dist/framework/Entity.js +125 -0
- package/dist/framework/authoring.d.ts +24 -0
- package/dist/framework/authoring.js +7 -0
- package/dist/framework/change-hooks.d.ts +119 -0
- package/dist/framework/change-hooks.js +131 -0
- package/dist/framework/changes.d.ts +88 -0
- package/dist/framework/changes.js +246 -0
- package/dist/framework/class-names.d.ts +260 -0
- package/dist/framework/class-names.js +630 -0
- package/dist/framework/coalesce.d.ts +25 -0
- package/dist/framework/coalesce.js +60 -0
- package/dist/framework/config-op.d.ts +76 -0
- package/dist/framework/config-op.js +43 -0
- package/dist/framework/config-operation-kind.d.ts +14 -0
- package/dist/framework/config-operation-kind.js +14 -0
- package/dist/framework/config-ops.d.ts +34 -0
- package/dist/framework/config-ops.js +187 -0
- package/dist/framework/defineConfig.d.ts +196 -0
- package/dist/framework/defineConfig.js +100 -0
- package/dist/framework/defineDerivedEntity.d.ts +74 -0
- package/dist/framework/defineDerivedEntity.js +83 -0
- package/dist/framework/defineEntity.d.ts +318 -0
- package/dist/framework/defineEntity.js +183 -0
- package/dist/framework/defineSubEntity.d.ts +148 -0
- package/dist/framework/defineSubEntity.js +121 -0
- package/dist/framework/derived-mutations.d.ts +20 -0
- package/dist/framework/derived-mutations.js +38 -0
- package/dist/framework/entity-search.d.ts +29 -0
- package/dist/framework/entity-search.js +117 -0
- package/dist/framework/inline-sources.d.ts +49 -0
- package/dist/framework/inline-sources.js +388 -0
- package/dist/framework/layer-styles.d.ts +25 -0
- package/dist/framework/layer-styles.js +49 -0
- package/dist/framework/memo.d.ts +48 -0
- package/dist/framework/memo.js +84 -0
- package/dist/framework/overlay.d.ts +49 -0
- package/dist/framework/overlay.js +17 -0
- package/dist/framework/plan.d.ts +49 -0
- package/dist/framework/plan.js +73 -0
- package/dist/framework/projections.d.ts +480 -0
- package/dist/framework/projections.js +974 -0
- package/dist/framework/prop-surface.d.ts +132 -0
- package/dist/framework/prop-surface.js +278 -0
- package/dist/framework/ref-graph.d.ts +71 -0
- package/dist/framework/ref-graph.js +158 -0
- package/dist/framework/ref-integrity.d.ts +55 -0
- package/dist/framework/ref-integrity.js +171 -0
- package/dist/framework/registered.d.ts +95 -0
- package/dist/framework/registry-dir.d.ts +42 -0
- package/dist/framework/registry-dir.js +48 -0
- package/dist/framework/registry.d.ts +300 -0
- package/dist/framework/registry.js +104 -0
- package/dist/framework/rejection.d.ts +58 -0
- package/dist/framework/rejection.js +111 -0
- package/dist/framework/rename-inference.d.ts +26 -0
- package/dist/framework/rename-inference.js +50 -0
- package/dist/framework/render-spec.d.ts +296 -0
- package/dist/framework/render-spec.js +809 -0
- package/dist/framework/schema-version.d.ts +140 -0
- package/dist/framework/schema-version.js +214 -0
- package/dist/framework/schemas.d.ts +109 -0
- package/dist/framework/schemas.js +615 -0
- package/dist/framework/session.d.ts +196 -0
- package/dist/framework/session.js +367 -0
- package/dist/framework/signature.d.ts +15 -0
- package/dist/framework/signature.js +83 -0
- package/dist/framework/snapshot.d.ts +115 -0
- package/dist/framework/snapshot.js +277 -0
- package/dist/framework/source-integrity.d.ts +226 -0
- package/dist/framework/source-integrity.js +478 -0
- package/dist/framework/sources.d.ts +211 -0
- package/dist/framework/sources.js +89 -0
- package/dist/framework/utils/compiled-schema.d.ts +23 -0
- package/dist/framework/utils/compiled-schema.js +46 -0
- package/dist/framework/utils/content-key.d.ts +15 -0
- package/dist/framework/utils/content-key.js +33 -0
- package/dist/framework/utils/enumerated.d.ts +13 -0
- package/dist/framework/utils/enumerated.js +19 -0
- package/dist/framework/utils/field-path.d.ts +95 -0
- package/dist/framework/utils/field-path.js +136 -0
- package/dist/framework/utils/field-schema.d.ts +55 -0
- package/dist/framework/utils/field-schema.js +183 -0
- package/dist/framework/utils/group.d.ts +37 -0
- package/dist/framework/utils/group.js +13 -0
- package/dist/framework/utils/package-path.d.ts +37 -0
- package/dist/framework/utils/package-path.js +61 -0
- package/dist/framework/utils/refs.d.ts +194 -0
- package/dist/framework/utils/refs.js +403 -0
- package/dist/framework/validate-spec.d.ts +27 -0
- package/dist/framework/validate-spec.js +45 -0
- package/dist/framework/value-domain.d.ts +26 -0
- package/dist/framework/value-domain.js +202 -0
- package/dist/framework/views-facade.d.ts +15 -0
- package/dist/framework/views-facade.js +19 -0
- package/dist/index.d.ts +90 -42
- package/dist/index.js +86 -37
- package/dist/migrations/2.0.0/raw-css.d.ts +11 -0
- package/dist/migrations/2.0.0/raw-css.js +72 -0
- package/dist/migrations/2.0.0/v1-artifact.d.ts +1559 -0
- package/dist/migrations/2.0.0/v1-artifact.js +1018 -0
- package/dist/migrations/20260908171448_settings_as_kind.d.ts +22 -0
- package/dist/migrations/20260908171448_settings_as_kind.js +89 -0
- package/dist/migrations/20260908194245_visible_state_pointer.d.ts +19 -0
- package/dist/migrations/20260908194245_visible_state_pointer.js +115 -0
- package/dist/migrations/20260909183001_icon_knockout_variants.d.ts +18 -0
- package/dist/migrations/20260909183001_icon_knockout_variants.js +8 -0
- package/dist/migrations/20260910212453_linked_system_link_ops.d.ts +13 -0
- package/dist/migrations/20260910212453_linked_system_link_ops.js +8 -0
- package/dist/migrations/index.d.ts +2 -0
- package/dist/migrations/index.js +2 -0
- package/dist/react-native/style-keys.generated.d.ts +10 -0
- package/dist/react-native/style-keys.generated.js +167 -0
- package/dist/renderer/RendererErrorBoundary.d.ts +32 -5
- package/dist/renderer/RendererErrorBoundary.js +59 -10
- package/dist/renderer/UdsRenderer.d.ts +11 -10
- package/dist/renderer/UdsRenderer.js +1 -1
- package/dist/renderer/assetEntries.d.ts +37 -0
- package/dist/renderer/assetEntries.js +39 -0
- package/dist/renderer/assetRenderable.d.ts +14 -6
- package/dist/renderer/assetRenderable.js +8 -2
- package/dist/renderer/componentEntry.d.ts +58 -0
- package/dist/renderer/componentEntry.js +71 -0
- package/dist/renderer/icon-library.d.ts +20 -0
- package/dist/renderer/index.d.ts +7 -7
- package/dist/renderer/index.js +5 -5
- package/dist/renderer/primitives/SlotRenderer.d.ts +1 -1
- package/dist/renderer/primitives/SlotRenderer.js +1 -1
- package/dist/renderer/runtimeComponent.d.ts +33 -0
- package/dist/renderer/runtimeComponent.js +113 -0
- package/dist/renderer/spec-content.d.ts +43 -0
- package/dist/renderer/spec-content.js +95 -0
- package/dist/renderer/wrapRegistry.d.ts +22 -37
- package/dist/renderer/wrapRegistry.js +10 -20
- package/dist/renderer/wrappers/event-bridge.js +6 -5
- package/dist/renderer/wrappers/hex-normalize.js +6 -5
- package/dist/renderer/wrappers/html-aliases.d.ts +7 -2
- package/dist/renderer/wrappers/html-aliases.js +36 -19
- package/dist/renderer/wrappers/inline-styles.js +7 -6
- package/dist/spec/asset-jsx.d.ts +18 -5
- package/dist/spec/asset-jsx.js +27 -16
- package/dist/spec/collapse-text-labels.d.ts +5 -15
- package/dist/spec/collapse-text-labels.js +26 -19
- package/dist/spec/empty-node-slots.d.ts +56 -34
- package/dist/spec/empty-node-slots.js +87 -47
- package/dist/spec/index.d.ts +21 -10
- package/dist/spec/index.js +21 -10
- package/dist/spec/jsxToSpec.d.ts +14 -9
- package/dist/spec/jsxToSpec.js +20 -3
- package/dist/spec/preview-elements.d.ts +63 -0
- package/dist/spec/preview-elements.js +89 -0
- package/dist/spec/rewrite-refs.d.ts +58 -0
- package/dist/spec/rewrite-refs.js +250 -0
- package/dist/spec/specToJsx.js +18 -29
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -52
- package/dist/AssetGroup.d.ts +0 -77
- package/dist/AssetGroup.js +0 -125
- package/dist/Component.d.ts +0 -333
- package/dist/Component.js +0 -1061
- package/dist/ComponentGroup.d.ts +0 -22
- package/dist/ComponentGroup.js +0 -51
- package/dist/CompositeStyle.d.ts +0 -30
- package/dist/CompositeStyle.js +0 -59
- package/dist/Config.d.ts +0 -528
- package/dist/Config.js +0 -1712
- package/dist/Mode.d.ts +0 -41
- package/dist/Mode.js +0 -81
- package/dist/Modifier.d.ts +0 -51
- package/dist/Modifier.js +0 -97
- package/dist/MotionDef.d.ts +0 -81
- package/dist/MotionDef.js +0 -212
- package/dist/Props.d.ts +0 -332
- package/dist/Props.js +0 -35
- package/dist/Provider.d.ts +0 -20
- package/dist/Provider.js +0 -14
- package/dist/StyleProp.d.ts +0 -145
- package/dist/StyleProp.js +0 -239
- package/dist/Token.d.ts +0 -76
- package/dist/Token.js +0 -133
- package/dist/TokenGroup.d.ts +0 -33
- package/dist/TokenGroup.js +0 -69
- package/dist/asset-kind.d.ts +0 -55
- package/dist/asset-kind.js +0 -29
- package/dist/asset-value.d.ts +0 -23
- package/dist/asset-value.js +0 -40
- package/dist/brands.d.ts +0 -30
- package/dist/brands.js +0 -20
- package/dist/captureCallerPath.d.ts +0 -48
- package/dist/captureCallerPath.js +0 -95
- package/dist/colorExpressions.d.ts +0 -131
- package/dist/colorExpressions.js +0 -148
- package/dist/component-referrers.d.ts +0 -30
- package/dist/component-referrers.js +0 -40
- package/dist/config-diagnostics.d.ts +0 -21
- package/dist/config-diagnostics.js +0 -12
- package/dist/defineAssetGroup.d.ts +0 -200
- package/dist/defineAssetGroup.js +0 -323
- package/dist/defineProvider.d.ts +0 -29
- package/dist/defineProvider.js +0 -60
- package/dist/element-marker.d.ts +0 -63
- package/dist/element-marker.js +0 -113
- package/dist/entity-utils.d.ts +0 -56
- package/dist/entity-utils.js +0 -105
- package/dist/extension.d.ts +0 -55
- package/dist/extension.js +0 -214
- package/dist/factories.d.ts +0 -863
- package/dist/factories.js +0 -475
- package/dist/font-face.d.ts +0 -25
- package/dist/font-face.js +0 -72
- package/dist/foreign-component-name.d.ts +0 -21
- package/dist/foreign-component-name.js +0 -42
- package/dist/interpolate.d.ts +0 -20
- package/dist/interpolate.js +0 -10
- package/dist/jsx/__fixtures__/cross-component-preview.d.ts +0 -3
- package/dist/jsx/__fixtures__/cross-component-preview.js +0 -15
- package/dist/jsx/jsx-dev-runtime.d.ts +0 -15
- package/dist/jsx/jsx-dev-runtime.js +0 -11
- package/dist/jsx/jsx-runtime.d.ts +0 -48
- package/dist/jsx/jsx-runtime.js +0 -305
- package/dist/linked-system-pins.d.ts +0 -30
- package/dist/linked-system-pins.js +0 -45
- package/dist/linkedNodePrefixes.d.ts +0 -73
- package/dist/linkedNodePrefixes.js +0 -99
- package/dist/markers.d.ts +0 -235
- package/dist/markers.js +0 -70
- package/dist/motion-constants.d.ts +0 -37
- package/dist/motion-constants.js +0 -61
- package/dist/native/NativeConfig.d.ts +0 -56
- package/dist/native/NativeConfig.js +0 -162
- package/dist/native/assets.d.ts +0 -20
- package/dist/native/assets.js +0 -17
- package/dist/native/components.d.ts +0 -139
- package/dist/native/components.js +0 -67
- package/dist/native/index.d.ts +0 -18
- package/dist/native/index.js +0 -17
- package/dist/native/modes.d.ts +0 -10
- package/dist/native/modes.js +0 -11
- package/dist/native/types.d.ts +0 -95
- package/dist/native/types.js +0 -0
- package/dist/native/validation.d.ts +0 -8
- package/dist/native/validation.js +0 -885
- package/dist/native/values.d.ts +0 -7
- package/dist/native/values.js +0 -15
- package/dist/native.d.ts +0 -12
- package/dist/native.js +0 -10
- package/dist/refs.d.ts +0 -204
- package/dist/refs.js +0 -129
- package/dist/registry-aliases.d.ts +0 -33
- package/dist/registry-aliases.js +0 -35
- package/dist/registry-dir.d.ts +0 -22
- package/dist/registry-dir.js +0 -10
- package/dist/renderer/makeRegistry.d.ts +0 -34
- package/dist/renderer/makeRegistry.js +0 -52
- package/dist/renderer/makeUdsRenderer.d.ts +0 -13
- package/dist/renderer/makeUdsRenderer.js +0 -51
- package/dist/renderer/wrappers/component-slots.d.ts +0 -41
- package/dist/renderer/wrappers/component-slots.js +0 -66
- package/dist/renderer/wrappers/slot-resolution.d.ts +0 -25
- package/dist/renderer/wrappers/slot-resolution.js +0 -68
- package/dist/renderer/wrappers/void-elements.d.ts +0 -37
- package/dist/renderer/wrappers/void-elements.js +0 -40
- package/dist/spec/layer-props.d.ts +0 -52
- package/dist/spec/layer-props.js +0 -149
- package/dist/spec/preview-controls.d.ts +0 -44
- package/dist/spec/preview-controls.js +0 -139
- package/dist/spec/slot-refs.d.ts +0 -39
- package/dist/spec/slot-refs.js +0 -56
- package/dist/token-override-rows.d.ts +0 -68
- package/dist/token-override-rows.js +0 -233
- package/dist/tokenValueType.d.ts +0 -34
- package/dist/tokenValueType.js +0 -138
- package/dist/types/css-properties.d.ts +0 -233
- package/dist/types/css-properties.js +0 -14
- package/dist/types/css-property-keywords.d.ts +0 -156
- package/dist/types/css-property-keywords.js +0 -616
- package/dist/types/css-values.d.ts +0 -63
- package/dist/types/css-values.js +0 -16
- package/dist/types.d.ts +0 -1138
- package/dist/types.js +0 -12
- package/dist/units.d.ts +0 -14
- package/dist/units.js +0 -16
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.js +0 -4
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { ref, splitRef } from "../../framework/utils/refs.js";
|
|
2
|
+
import { Settings } from "./Settings.js";
|
|
3
|
+
import { createSliceMemo } from "../../framework/memo.js";
|
|
4
|
+
import { File } from "./File.js";
|
|
5
|
+
import { Component } from "./Component.js";
|
|
6
|
+
import { contentKey } from "../../framework/utils/content-key.js";
|
|
7
|
+
import { isNativeConfig } from "../../configs/platform.js";
|
|
8
|
+
//#region src/entities/system/component-module.ts
|
|
9
|
+
/**
|
|
10
|
+
* What names a compiled component module: a content key over the module's config-visible build
|
|
11
|
+
* closure. The build stores the artifact under this key and the canvas requests it by the same
|
|
12
|
+
* formula, so "is the stored module current" is never asked: an input edit mints a new key, the
|
|
13
|
+
* request misses, and the miss is the rebuild trigger.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The shared compiler/runtime contract. Bump whenever codegen can produce different module bytes
|
|
17
|
+
* from identical config-visible inputs (shim contracts, entry shape, transforms, and so on).
|
|
18
|
+
*/
|
|
19
|
+
const COMPONENT_MODULE_BUILD_VERSION = 3;
|
|
20
|
+
/**
|
|
21
|
+
* Generated web runtime inputs shared by every component module. These are intentionally separate
|
|
22
|
+
* from the per-file closure: editing an unrelated component should not invalidate this module, but
|
|
23
|
+
* changing the runtime that interprets its styles must.
|
|
24
|
+
*/
|
|
25
|
+
const WEB_RUNTIME_KINDS = [
|
|
26
|
+
"style-property",
|
|
27
|
+
"modifier",
|
|
28
|
+
"motion",
|
|
29
|
+
"composite"
|
|
30
|
+
];
|
|
31
|
+
const componentsByFileCache = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
/** Documentation and examples never enter emitted component modules. */
|
|
33
|
+
function buildEntityBody(kind, body) {
|
|
34
|
+
if (kind !== "component") return body;
|
|
35
|
+
const { previewProps: _preview, description: _description, ...buildBody } = body;
|
|
36
|
+
return buildBody;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The generated runtime embedded in every web component module. Config v2 structurally shares
|
|
40
|
+
* unchanged kind slices, so component edits reuse this full-runtime projection without walking it.
|
|
41
|
+
*/
|
|
42
|
+
const componentRuntimeEntitiesKey = createSliceMemo({
|
|
43
|
+
kinds: WEB_RUNTIME_KINDS,
|
|
44
|
+
compute: (config) => {
|
|
45
|
+
const entities = {};
|
|
46
|
+
const groups = {};
|
|
47
|
+
for (const kind of WEB_RUNTIME_KINDS) {
|
|
48
|
+
for (const entity of config.list(kind)) entities[`${kind}:${entity.path}`] = entity.toJSON();
|
|
49
|
+
for (const group of config.groups(kind)) groups[`${kind}:${group.path}`] = group.meta;
|
|
50
|
+
}
|
|
51
|
+
return contentKey({
|
|
52
|
+
entities,
|
|
53
|
+
groups
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
function componentRuntimeKey(config) {
|
|
58
|
+
return contentKey({
|
|
59
|
+
version: COMPONENT_MODULE_BUILD_VERSION,
|
|
60
|
+
name: config.name,
|
|
61
|
+
settings: Settings.get(config)?.toJSON(),
|
|
62
|
+
entities: componentRuntimeEntitiesKey(config)
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** Every local sealed file -> the components it declares. One file is one module. */
|
|
66
|
+
function componentsByFile(config) {
|
|
67
|
+
const cached = componentsByFileCache.get(config);
|
|
68
|
+
if (cached) return cached;
|
|
69
|
+
const byFile = /* @__PURE__ */ new Map();
|
|
70
|
+
for (const component of Component.list(config)) {
|
|
71
|
+
const { file, export: exportName } = component.body;
|
|
72
|
+
if (!file || !exportName) continue;
|
|
73
|
+
const ref = splitRef(file.__ref);
|
|
74
|
+
if (ref.source) continue;
|
|
75
|
+
const components = byFile.get(ref.path) ?? [];
|
|
76
|
+
components.push(component);
|
|
77
|
+
byFile.set(ref.path, components);
|
|
78
|
+
}
|
|
79
|
+
componentsByFileCache.set(config, byFile);
|
|
80
|
+
return byFile;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Component-only imports made by one sealed file, expressed in config-v2's existing identities.
|
|
84
|
+
*
|
|
85
|
+
* `File.imports` already records the authored specifier, resolved File, and imported names;
|
|
86
|
+
* `Component.file` + `Component.export` already say which of those names are registry components.
|
|
87
|
+
* Joining those facts here avoids inventing another dependency graph for incremental modules.
|
|
88
|
+
*/
|
|
89
|
+
function componentRegistryImports(config, filePath) {
|
|
90
|
+
const file = File.get(config, filePath);
|
|
91
|
+
if (!file?.imports) return [];
|
|
92
|
+
const byFile = componentsByFile(config);
|
|
93
|
+
const imports = [];
|
|
94
|
+
for (const [specifier, imported] of Object.entries(file.imports)) {
|
|
95
|
+
if (!imported.target || !imported.names || imported.names.length === 0) continue;
|
|
96
|
+
const target = splitRef(imported.target.__ref);
|
|
97
|
+
if (target.kind !== "file" || target.source) continue;
|
|
98
|
+
const byExport = /* @__PURE__ */ new Map();
|
|
99
|
+
const ambiguous = /* @__PURE__ */ new Set();
|
|
100
|
+
for (const component of byFile.get(target.path) ?? []) {
|
|
101
|
+
const { export: exportName } = component.body;
|
|
102
|
+
if (!exportName) continue;
|
|
103
|
+
if (byExport.has(exportName)) ambiguous.add(exportName);
|
|
104
|
+
byExport.set(exportName, {
|
|
105
|
+
componentRef: Component.ref(component.path).__ref,
|
|
106
|
+
exportName
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const bindings = imported.names.flatMap((name) => {
|
|
110
|
+
if (name === "*" || ambiguous.has(name)) return [];
|
|
111
|
+
const binding = byExport.get(name);
|
|
112
|
+
return binding ? [binding] : [];
|
|
113
|
+
});
|
|
114
|
+
if (bindings.length !== imported.names.length) continue;
|
|
115
|
+
imports.push({
|
|
116
|
+
specifier,
|
|
117
|
+
targetFilePath: target.path,
|
|
118
|
+
bindings
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return imports.sort((left, right) => left.specifier.localeCompare(right.specifier));
|
|
122
|
+
}
|
|
123
|
+
function componentModuleBuildPlan(config, filePath) {
|
|
124
|
+
const byFile = componentsByFile(config);
|
|
125
|
+
const entities = {};
|
|
126
|
+
const groups = {};
|
|
127
|
+
const registryComponents = {};
|
|
128
|
+
const settings = { own: {
|
|
129
|
+
name: config.name,
|
|
130
|
+
settings: Settings.get(config)?.toJSON()
|
|
131
|
+
} };
|
|
132
|
+
const visitedComponents = /* @__PURE__ */ new Set();
|
|
133
|
+
const visitedFiles = /* @__PURE__ */ new Set();
|
|
134
|
+
const pendingFiles = [filePath];
|
|
135
|
+
const recordGroups = (owner, source, kind, path) => {
|
|
136
|
+
if (source) settings[`source:${source}`] ??= {
|
|
137
|
+
name: owner.name,
|
|
138
|
+
settings: Settings.get(owner)?.toJSON()
|
|
139
|
+
};
|
|
140
|
+
for (const group of owner.groups(kind)) {
|
|
141
|
+
if (!path.startsWith(`${group.path}/`)) continue;
|
|
142
|
+
groups[`${source ? `${source}:` : ""}${kind}:${group.path}`] = group.meta;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const recordEntity = (target) => {
|
|
146
|
+
const ref = splitRef(target);
|
|
147
|
+
const owner = ref.source ? config.sourceFor(ref.source) : config;
|
|
148
|
+
const entity = owner?.resolve(ref.kind, ref.path);
|
|
149
|
+
if (!owner || !entity) return;
|
|
150
|
+
const key = `${ref.source ? `${ref.source}:` : ""}${ref.kind}:${ref.path}`;
|
|
151
|
+
entities[key] = buildEntityBody(ref.kind, entity.toJSON());
|
|
152
|
+
recordGroups(owner, ref.source, ref.kind, ref.path);
|
|
153
|
+
if (ref.kind === "file" && !ref.source) pendingFiles.push(ref.path);
|
|
154
|
+
};
|
|
155
|
+
const recordRegistryComponent = (target) => {
|
|
156
|
+
const parsed = splitRef(target);
|
|
157
|
+
if (parsed.kind !== "component" || parsed.source) return false;
|
|
158
|
+
const component = Component.get(config, parsed.path);
|
|
159
|
+
const { file, export: exportName } = component?.body ?? {};
|
|
160
|
+
if (!component || !file || !exportName) return false;
|
|
161
|
+
const owner = splitRef(file.__ref);
|
|
162
|
+
if (owner.kind !== "file" || owner.source) return false;
|
|
163
|
+
registryComponents[Component.ref(component.path).__ref] = {
|
|
164
|
+
filePath: owner.path,
|
|
165
|
+
exportName
|
|
166
|
+
};
|
|
167
|
+
return true;
|
|
168
|
+
};
|
|
169
|
+
const recordDependencyClosure = (target) => {
|
|
170
|
+
const parsed = splitRef(target);
|
|
171
|
+
if (recordRegistryComponent(target)) return;
|
|
172
|
+
recordEntity(target);
|
|
173
|
+
if (parsed.kind === "file") return;
|
|
174
|
+
const owner = parsed.source ? config.sourceFor(parsed.source) : config;
|
|
175
|
+
if (!owner) return;
|
|
176
|
+
for (const dependency of owner.dependenciesOf(parsed.kind, parsed.path, { transitive: true })) {
|
|
177
|
+
const nested = splitRef(dependency);
|
|
178
|
+
const qualified = parsed.source && !nested.source ? ref(nested.kind, nested.path, parsed.source).__ref : dependency;
|
|
179
|
+
if (!recordRegistryComponent(qualified)) recordEntity(qualified);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
const recordComponent = (component) => {
|
|
183
|
+
if (visitedComponents.has(component.path)) return;
|
|
184
|
+
visitedComponents.add(component.path);
|
|
185
|
+
recordEntity(`component:${component.path}`);
|
|
186
|
+
for (const dependency of config.dependenciesOf("component", component.path)) recordDependencyClosure(dependency);
|
|
187
|
+
};
|
|
188
|
+
while (pendingFiles.length > 0) {
|
|
189
|
+
const next = pendingFiles.pop();
|
|
190
|
+
if (!next || visitedFiles.has(next)) continue;
|
|
191
|
+
visitedFiles.add(next);
|
|
192
|
+
const file = File.get(config, next);
|
|
193
|
+
if (!file?.hash) continue;
|
|
194
|
+
recordEntity(`file:${next}`);
|
|
195
|
+
const imports = file.body.imports ?? {};
|
|
196
|
+
const registryImports = new Map(componentRegistryImports(config, next).map((entry) => [entry.specifier, entry]));
|
|
197
|
+
for (const [specifier, imported] of Object.entries(imports)) {
|
|
198
|
+
const registryImport = registryImports.get(specifier);
|
|
199
|
+
if (registryImport) {
|
|
200
|
+
for (const binding of registryImport.bindings) recordRegistryComponent(binding.componentRef);
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (imported.target) recordEntity(imported.target.__ref);
|
|
204
|
+
}
|
|
205
|
+
for (const component of byFile.get(next) ?? []) recordComponent(component);
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
version: COMPONENT_MODULE_BUILD_VERSION,
|
|
209
|
+
runtimeKey: componentRuntimeKey(config),
|
|
210
|
+
settings,
|
|
211
|
+
entities,
|
|
212
|
+
groups,
|
|
213
|
+
registryComponents
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Local sealed files required to rebuild one component module. This is the File half of the exact
|
|
218
|
+
* build plan used by {@link componentModuleKey}: the entry and its statically imported helpers.
|
|
219
|
+
* Component-only imports stop at stable registry refs; package pins and linked-system files stay in
|
|
220
|
+
* the key but have no local bytes for this branch to fetch.
|
|
221
|
+
*/
|
|
222
|
+
function componentModuleFilePaths(config, filePath) {
|
|
223
|
+
return Object.keys(componentModuleBuildPlan(config, filePath).entities).filter((key) => key.startsWith("file:")).map((key) => key.slice(5)).sort();
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* One sealed local file's web module key, or `undefined` when the file is not sealed. Stable across
|
|
227
|
+
* clients: the key is a sorted-serialization content hash, so two holders of one config spell it
|
|
228
|
+
* identically.
|
|
229
|
+
*/
|
|
230
|
+
function componentModuleKey(config, filePath) {
|
|
231
|
+
if (!File.get(config, filePath)?.hash) return void 0;
|
|
232
|
+
return contentKey(componentModuleBuildPlan(config, filePath));
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Resolve a component ref through config-v2's existing Component -> File facts to the independently
|
|
236
|
+
* rebuildable module that owns it. Studio-authored anatomy has no File and linked source files are
|
|
237
|
+
* not owned by this config's branch, so neither claims a local runtime URL.
|
|
238
|
+
*/
|
|
239
|
+
function componentModuleSource(config, componentPathOrRef) {
|
|
240
|
+
if (isNativeConfig(config)) return void 0;
|
|
241
|
+
const component = Component.get(config, componentPathOrRef);
|
|
242
|
+
if (!component) return void 0;
|
|
243
|
+
const { file, export: exportName } = component.body;
|
|
244
|
+
if (!file || !exportName) return void 0;
|
|
245
|
+
const ref = splitRef(file.__ref);
|
|
246
|
+
if (ref.source) return void 0;
|
|
247
|
+
const moduleKey = componentModuleKey(config, ref.path);
|
|
248
|
+
if (!moduleKey) return void 0;
|
|
249
|
+
return {
|
|
250
|
+
componentRef: Component.ref(component.path).__ref,
|
|
251
|
+
filePath: ref.path,
|
|
252
|
+
moduleKey,
|
|
253
|
+
exportName,
|
|
254
|
+
entryExportName: `${exportName}Entry`
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
export { componentModuleFilePaths, componentModuleKey, componentModuleSource, componentRegistryImports };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Config, Patch } from "../../framework/Config.js";
|
|
2
|
+
|
|
3
|
+
//#region src/entities/system/copy-plan.d.ts
|
|
4
|
+
/** `copy`'s own input, as a plan takes it — `path` is the link's slug, spelled as the op spells it. */
|
|
5
|
+
interface CopyPlanInput {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
/**
|
|
8
|
+
* What to take, keyed by accessor: `'*'` for every entry of that kind, or the source's paths, where a
|
|
9
|
+
* path that names a folder takes its members. `'*'` alone takes every kind the source offers and
|
|
10
|
+
* this config can hold.
|
|
11
|
+
*/
|
|
12
|
+
readonly data: '*' | Readonly<Record<string, '*' | readonly string[]>>;
|
|
13
|
+
/**
|
|
14
|
+
* What happens at a path this config already holds. `'skip'` (the default) reuses the row and binds
|
|
15
|
+
* copied refs to it; `'replace'` writes the source's body over a row of yours, and over a row held
|
|
16
|
+
* through another pin when the call names it. A row the copy only reaches through a ref stays the
|
|
17
|
+
* other pin's either way.
|
|
18
|
+
*/
|
|
19
|
+
readonly onConflict?: 'skip' | 'replace';
|
|
20
|
+
}
|
|
21
|
+
/** One entry a source path names: the source's path and where it lands here. */
|
|
22
|
+
interface SourceEntry {
|
|
23
|
+
readonly from: string;
|
|
24
|
+
readonly to: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The source's entries one path names: every item of the kind for `'*'`, a folder's members for a
|
|
28
|
+
* group path, the item itself otherwise. Rows keep the source's own names.
|
|
29
|
+
*/
|
|
30
|
+
declare function sourceEntries({
|
|
31
|
+
source,
|
|
32
|
+
kind,
|
|
33
|
+
path
|
|
34
|
+
}: {
|
|
35
|
+
/** The source config — the catalogue being drawn from, not the one borrowing. */readonly source: Config;
|
|
36
|
+
readonly kind: string;
|
|
37
|
+
readonly path: string;
|
|
38
|
+
}): readonly SourceEntry[];
|
|
39
|
+
/** One row a copy lands. */
|
|
40
|
+
interface CopyPlanRow {
|
|
41
|
+
readonly kind: string;
|
|
42
|
+
/** Where it lands here, which is also the path the source spells. */
|
|
43
|
+
readonly path: string;
|
|
44
|
+
/**
|
|
45
|
+
* `create` for a path nothing of yours holds, or one inherited by the pin's declaration; `replace`
|
|
46
|
+
* for a pointer stored at the path, which becomes the literal it stood for; `overwrite` for a row of
|
|
47
|
+
* yours, or one held through another pin, that the call asked to write over (`onConflict: 'replace'`).
|
|
48
|
+
*/
|
|
49
|
+
readonly status: 'create' | 'replace' | 'overwrite';
|
|
50
|
+
/** Named by the call, as opposed to brought along because something named points at it. */
|
|
51
|
+
readonly named: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* What one `copy` call does, as data — the rows that land, the folders whose meta comes with them, and
|
|
55
|
+
* the rows of yours that copied refs bind to instead of copying over.
|
|
56
|
+
*
|
|
57
|
+
* `patches` is the same answer as the write the op makes: the op applies exactly these, so a surface
|
|
58
|
+
* that plans a copy and the copy it then runs cannot disagree.
|
|
59
|
+
*/
|
|
60
|
+
interface CopyPlan {
|
|
61
|
+
readonly rows: readonly CopyPlanRow[];
|
|
62
|
+
readonly folders: readonly {
|
|
63
|
+
kind: string;
|
|
64
|
+
path: string;
|
|
65
|
+
}[];
|
|
66
|
+
/** Paths this config already holds as its own, which a copied ref points at rather than through the pin. */
|
|
67
|
+
readonly reused: readonly {
|
|
68
|
+
kind: string;
|
|
69
|
+
path: string;
|
|
70
|
+
}[];
|
|
71
|
+
/** Rows of this config's own whose refs at a copied entity are respelled bare, so they point at the
|
|
72
|
+
* copy rather than through the pin. */
|
|
73
|
+
readonly rebound: readonly {
|
|
74
|
+
kind: string;
|
|
75
|
+
path: string;
|
|
76
|
+
}[];
|
|
77
|
+
readonly patches: readonly Patch[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* What `copy` would do with this input, and the patches that do it.
|
|
81
|
+
*
|
|
82
|
+
* A copied row stands on its own: every ref into the source is followed and its target is taken too,
|
|
83
|
+
* unless this config already holds that path — then the copy points at what is here. A code
|
|
84
|
+
* component's files come along the same way, so the copy renders from its own rows. A ref through a
|
|
85
|
+
* third system is theirs to resolve and is left as spelled, and a kind this config can't hold stays
|
|
86
|
+
* qualified, since the pin survives to answer it.
|
|
87
|
+
*
|
|
88
|
+
* Refuses exactly what the op refuses, since the op is this plan applied.
|
|
89
|
+
*/
|
|
90
|
+
declare function planCopy({
|
|
91
|
+
config,
|
|
92
|
+
input
|
|
93
|
+
}: {
|
|
94
|
+
readonly config: Config;
|
|
95
|
+
readonly input: CopyPlanInput;
|
|
96
|
+
}): CopyPlan;
|
|
97
|
+
//#endregion
|
|
98
|
+
export { CopyPlan, CopyPlanInput, CopyPlanRow, planCopy, sourceEntries };
|