@metaobjectsdev/metadata 0.21.2 → 0.21.4-rc.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.
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Browser-safe metamodel constants.
3
+ *
4
+ * Every metamodel string — type names, subtype names, attribute names — lives in a
5
+ * per-concern `*-constants.ts` module. This barrel re-exports them and **nothing else**,
6
+ * so it can be imported from a browser bundle.
7
+ *
8
+ * <h3>Why this exists (#287)</h3>
9
+ * The package root (`@metaobjectsdev/metadata`) exports `MetaDataLoader`, which imports
10
+ * `library/library-sources.ts`, which does `import { fileURLToPath } from "node:url"`.
11
+ * So *any* value import from the root barrel — even a single string constant — drags the
12
+ * Node-only loader into a browser bundle and the build fails:
13
+ *
14
+ * error: Browser polyfill for module "node:url" doesn't have a matching export
15
+ * named "fileURLToPath" … metadata/dist/library/library-sources.js
16
+ *
17
+ * That made **every** client consuming the generated TanStack hooks unbuildable, because
18
+ * each generated `<Entity>.hooks.ts` imports from `@metaobjectsdev/runtime-web`, which
19
+ * imported six `LAYOUT_*` constants from the root. The root barrel already guards one
20
+ * Node-only module (`registry-coverage.ts`, kept out deliberately with a comment saying
21
+ * why) — `library-sources` reaches it through the loader instead.
22
+ *
23
+ * <h3>The rule</h3>
24
+ * Browser-facing packages (`client/web/**`) import metamodel VALUES from
25
+ * `@metaobjectsdev/metadata/constants`, never from the package root. Types may still come
26
+ * from the root — `import type` is erased at build time and cannot drag a runtime
27
+ * dependency with it.
28
+ *
29
+ * Inlining the strings instead would violate the project's constants discipline
30
+ * ("never inline metamodel strings as literals in code"), so the fix is a safe import
31
+ * path rather than duplicated literals.
32
+ *
33
+ * **Do not add anything to this file that is not a pure constant module.** A single
34
+ * transitive `node:*` import here silently re-breaks every browser build; the
35
+ * `browser-safe-constants` test asserts that by bundling this entry for the browser.
36
+ */
37
+ export * from "./core/attr/attr-constants.js";
38
+ export * from "./core/documentation/doc-constants.js";
39
+ export * from "./core/field/field-constants.js";
40
+ export * from "./core/identity/identity-constants.js";
41
+ export * from "./core/index/index-constants.js";
42
+ export * from "./core/object/object-constants.js";
43
+ export * from "./core/query/query-constants.js";
44
+ export * from "./core/relationship/relationship-constants.js";
45
+ export * from "./core/validator/validator-constants.js";
46
+ export * from "./persistence/db/db-constants.js";
47
+ export * from "./persistence/origin/origin-constants.js";
48
+ export * from "./persistence/source/source-constants.js";
49
+ export * from "./presentation/layout/layout-constants.js";
50
+ export * from "./presentation/view/view-constants.js";
51
+ export * from "./template/template-constants.js";
52
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,yCAAyC,CAAC;AACxD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Browser-safe metamodel constants.
3
+ *
4
+ * Every metamodel string — type names, subtype names, attribute names — lives in a
5
+ * per-concern `*-constants.ts` module. This barrel re-exports them and **nothing else**,
6
+ * so it can be imported from a browser bundle.
7
+ *
8
+ * <h3>Why this exists (#287)</h3>
9
+ * The package root (`@metaobjectsdev/metadata`) exports `MetaDataLoader`, which imports
10
+ * `library/library-sources.ts`, which does `import { fileURLToPath } from "node:url"`.
11
+ * So *any* value import from the root barrel — even a single string constant — drags the
12
+ * Node-only loader into a browser bundle and the build fails:
13
+ *
14
+ * error: Browser polyfill for module "node:url" doesn't have a matching export
15
+ * named "fileURLToPath" … metadata/dist/library/library-sources.js
16
+ *
17
+ * That made **every** client consuming the generated TanStack hooks unbuildable, because
18
+ * each generated `<Entity>.hooks.ts` imports from `@metaobjectsdev/runtime-web`, which
19
+ * imported six `LAYOUT_*` constants from the root. The root barrel already guards one
20
+ * Node-only module (`registry-coverage.ts`, kept out deliberately with a comment saying
21
+ * why) — `library-sources` reaches it through the loader instead.
22
+ *
23
+ * <h3>The rule</h3>
24
+ * Browser-facing packages (`client/web/**`) import metamodel VALUES from
25
+ * `@metaobjectsdev/metadata/constants`, never from the package root. Types may still come
26
+ * from the root — `import type` is erased at build time and cannot drag a runtime
27
+ * dependency with it.
28
+ *
29
+ * Inlining the strings instead would violate the project's constants discipline
30
+ * ("never inline metamodel strings as literals in code"), so the fix is a safe import
31
+ * path rather than duplicated literals.
32
+ *
33
+ * **Do not add anything to this file that is not a pure constant module.** A single
34
+ * transitive `node:*` import here silently re-breaks every browser build; the
35
+ * `browser-safe-constants` test asserts that by bundling this entry for the browser.
36
+ */
37
+ export * from "./core/attr/attr-constants.js";
38
+ export * from "./core/documentation/doc-constants.js";
39
+ export * from "./core/field/field-constants.js";
40
+ export * from "./core/identity/identity-constants.js";
41
+ export * from "./core/index/index-constants.js";
42
+ export * from "./core/object/object-constants.js";
43
+ export * from "./core/query/query-constants.js";
44
+ export * from "./core/relationship/relationship-constants.js";
45
+ export * from "./core/validator/validator-constants.js";
46
+ export * from "./persistence/db/db-constants.js";
47
+ export * from "./persistence/origin/origin-constants.js";
48
+ export * from "./persistence/source/source-constants.js";
49
+ export * from "./presentation/layout/layout-constants.js";
50
+ export * from "./presentation/view/view-constants.js";
51
+ export * from "./template/template-constants.js";
52
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,yCAAyC,CAAC;AACxD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaobjectsdev/metadata",
3
- "version": "0.21.2",
3
+ "version": "0.21.4-rc.1",
4
4
  "description": "Metamodel loader, types, and constants for the MetaObjects standard.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,6 +15,11 @@
15
15
  "bun": "./src/core/index.ts",
16
16
  "types": "./dist/core/index.d.ts",
17
17
  "default": "./dist/core/index.js"
18
+ },
19
+ "./constants": {
20
+ "bun": "./src/constants.ts",
21
+ "types": "./dist/constants.d.ts",
22
+ "default": "./dist/constants.js"
18
23
  }
19
24
  },
20
25
  "files": [
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Browser-safe metamodel constants.
3
+ *
4
+ * Every metamodel string — type names, subtype names, attribute names — lives in a
5
+ * per-concern `*-constants.ts` module. This barrel re-exports them and **nothing else**,
6
+ * so it can be imported from a browser bundle.
7
+ *
8
+ * <h3>Why this exists (#287)</h3>
9
+ * The package root (`@metaobjectsdev/metadata`) exports `MetaDataLoader`, which imports
10
+ * `library/library-sources.ts`, which does `import { fileURLToPath } from "node:url"`.
11
+ * So *any* value import from the root barrel — even a single string constant — drags the
12
+ * Node-only loader into a browser bundle and the build fails:
13
+ *
14
+ * error: Browser polyfill for module "node:url" doesn't have a matching export
15
+ * named "fileURLToPath" … metadata/dist/library/library-sources.js
16
+ *
17
+ * That made **every** client consuming the generated TanStack hooks unbuildable, because
18
+ * each generated `<Entity>.hooks.ts` imports from `@metaobjectsdev/runtime-web`, which
19
+ * imported six `LAYOUT_*` constants from the root. The root barrel already guards one
20
+ * Node-only module (`registry-coverage.ts`, kept out deliberately with a comment saying
21
+ * why) — `library-sources` reaches it through the loader instead.
22
+ *
23
+ * <h3>The rule</h3>
24
+ * Browser-facing packages (`client/web/**`) import metamodel VALUES from
25
+ * `@metaobjectsdev/metadata/constants`, never from the package root. Types may still come
26
+ * from the root — `import type` is erased at build time and cannot drag a runtime
27
+ * dependency with it.
28
+ *
29
+ * Inlining the strings instead would violate the project's constants discipline
30
+ * ("never inline metamodel strings as literals in code"), so the fix is a safe import
31
+ * path rather than duplicated literals.
32
+ *
33
+ * **Do not add anything to this file that is not a pure constant module.** A single
34
+ * transitive `node:*` import here silently re-breaks every browser build; the
35
+ * `browser-safe-constants` test asserts that by bundling this entry for the browser.
36
+ */
37
+
38
+ export * from "./core/attr/attr-constants.js";
39
+ export * from "./core/documentation/doc-constants.js";
40
+ export * from "./core/field/field-constants.js";
41
+ export * from "./core/identity/identity-constants.js";
42
+ export * from "./core/index/index-constants.js";
43
+ export * from "./core/object/object-constants.js";
44
+ export * from "./core/query/query-constants.js";
45
+ export * from "./core/relationship/relationship-constants.js";
46
+ export * from "./core/validator/validator-constants.js";
47
+ export * from "./persistence/db/db-constants.js";
48
+ export * from "./persistence/origin/origin-constants.js";
49
+ export * from "./persistence/source/source-constants.js";
50
+ export * from "./presentation/layout/layout-constants.js";
51
+ export * from "./presentation/view/view-constants.js";
52
+ export * from "./template/template-constants.js";