@contractspec/lib.presentation-runtime-core 1.57.0 → 1.59.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.
@@ -0,0 +1,55 @@
1
+ // src/index.ts
2
+ function withPresentationNextAliases(config, opts = {}) {
3
+ const uiWeb = opts.uiKitWeb ?? "@contractspec/lib.ui-kit-web";
4
+ const uiNative = opts.uiKitNative ?? "@contractspec/lib.ui-kit";
5
+ const presReact = opts.presentationReact ?? "@contractspec/lib.presentation-runtime-react";
6
+ const presNative = opts.presentationNative ?? "@contractspec/lib.presentation-runtime-react-native";
7
+ config.resolve ??= {};
8
+ config.resolve.alias = {
9
+ ...config.resolve.alias || {},
10
+ [uiNative]: uiWeb,
11
+ [presNative]: presReact
12
+ };
13
+ config.resolve.extensions = [
14
+ ".web.js",
15
+ ".web.jsx",
16
+ ".web.ts",
17
+ ".web.tsx",
18
+ ...config.resolve.extensions || []
19
+ ];
20
+ return config;
21
+ }
22
+ function withPresentationMetroAliases(config, opts = {}) {
23
+ const uiWeb = opts.uiKitWeb ?? "@contractspec/lib.ui-kit-web";
24
+ const uiNative = opts.uiKitNative ?? "@contractspec/lib.ui-kit";
25
+ const presReact = opts.presentationReact ?? "@contractspec/lib.presentation-runtime-react";
26
+ const presNative = opts.presentationNative ?? "@contractspec/lib.presentation-runtime-react-native";
27
+ config.resolver ??= {};
28
+ config.resolver.unstable_enablePackageExports = true;
29
+ config.resolver.platforms = [
30
+ "ios",
31
+ "android",
32
+ "native",
33
+ "mobile",
34
+ "web",
35
+ ...config.resolver.platforms || []
36
+ ];
37
+ const original = config.resolver.resolveRequest;
38
+ config.resolver.resolveRequest = (ctx, moduleName, platform) => {
39
+ if (platform === "ios" || platform === "android" || platform === "native") {
40
+ if (typeof moduleName === "string" && moduleName.startsWith(uiWeb + "/ui")) {
41
+ const mapped = moduleName.replace(uiWeb + "/ui", uiNative + "/ui");
42
+ return (original ?? ctx.resolveRequest)(ctx, mapped, platform);
43
+ }
44
+ if (moduleName === presReact) {
45
+ return (original ?? ctx.resolveRequest)(ctx, presNative, platform);
46
+ }
47
+ }
48
+ return (original ?? ctx.resolveRequest)(ctx, moduleName, platform);
49
+ };
50
+ return config;
51
+ }
52
+ export {
53
+ withPresentationNextAliases,
54
+ withPresentationMetroAliases
55
+ };
package/dist/index.d.ts CHANGED
@@ -1,27 +1,24 @@
1
- //#region src/index.d.ts
2
- interface ListState<TFilters extends Record<string, unknown>> {
3
- q: string;
4
- page: number;
5
- limit: number;
6
- sort?: string | null;
7
- filters: TFilters;
1
+ export interface ListState<TFilters extends Record<string, unknown>> {
2
+ q: string;
3
+ page: number;
4
+ limit: number;
5
+ sort?: string | null;
6
+ filters: TFilters;
8
7
  }
9
- type ListFetcher<TVars, TItem> = (vars: TVars) => Promise<{
10
- items: TItem[];
11
- totalItems?: number;
12
- totalPages?: number;
8
+ export type ListFetcher<TVars, TItem> = (vars: TVars) => Promise<{
9
+ items: TItem[];
10
+ totalItems?: number;
11
+ totalPages?: number;
13
12
  }>;
14
- interface NextAliasOptions {
15
- uiKitWeb?: string;
16
- uiKitNative?: string;
17
- presentationReact?: string;
18
- presentationNative?: string;
13
+ export interface NextAliasOptions {
14
+ uiKitWeb?: string;
15
+ uiKitNative?: string;
16
+ presentationReact?: string;
17
+ presentationNative?: string;
19
18
  }
20
- declare function withPresentationNextAliases(config: any, opts?: NextAliasOptions): any;
21
- type MetroAliasOptions = NextAliasOptions & {
22
- monorepoRoot?: string;
19
+ export declare function withPresentationNextAliases(config: any, opts?: NextAliasOptions): any;
20
+ export type MetroAliasOptions = NextAliasOptions & {
21
+ monorepoRoot?: string;
23
22
  };
24
- declare function withPresentationMetroAliases(config: any, opts?: MetroAliasOptions): any;
25
- //#endregion
26
- export { ListFetcher, ListState, MetroAliasOptions, NextAliasOptions, withPresentationMetroAliases, withPresentationNextAliases };
23
+ export declare function withPresentationMetroAliases(config: any, opts?: MetroAliasOptions): any;
27
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";UAAiB,SAAA,kBAA2B,MAAA;EAC1C,CAAA;EACA,IAAA;EACA,KAAA;EACA,IAAA;EACA,OAAA,EAAS,QAAA;AAAA;AAAA,KAGC,WAAA,kBACV,IAAA,EAAM,KAAA,KACH,OAAA;EAAU,KAAA,EAAO,KAAA;EAAS,UAAA;EAAqB,UAAA;AAAA;AAAA,UAGnC,gBAAA;EACf,QAAA;EACA,WAAA;EACA,iBAAA;EACA,kBAAA;AAAA;AAAA,iBAGc,2BAAA,CAEd,MAAA,OACA,IAAA,GAAM,gBAAA;AAAA,KA0BI,iBAAA,GAAoB,gBAAA;EAC9B,YAAA;AAAA;AAAA,iBAGc,4BAAA,CAEd,MAAA,OACA,IAAA,GAAM,iBAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACjE,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,KAAK,IAAI,CACtC,IAAI,EAAE,KAAK,KACR,OAAO,CAAC;IAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAG3E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,2BAA2B,CAEzC,MAAM,EAAE,GAAG,EACX,IAAI,GAAE,gBAAqB,OAwB5B;AAED,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,GAAG;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,4BAA4B,CAE1C,MAAM,EAAE,GAAG,EACX,IAAI,GAAE,iBAAsB,OAgD7B"}
package/dist/index.js CHANGED
@@ -1,53 +1,56 @@
1
- //#region src/index.ts
1
+ // @bun
2
+ // src/index.ts
2
3
  function withPresentationNextAliases(config, opts = {}) {
3
- const uiWeb = opts.uiKitWeb ?? "@contractspec/lib.ui-kit-web";
4
- const uiNative = opts.uiKitNative ?? "@contractspec/lib.ui-kit";
5
- const presReact = opts.presentationReact ?? "@contractspec/lib.presentation-runtime-react";
6
- const presNative = opts.presentationNative ?? "@contractspec/lib.presentation-runtime-react-native";
7
- config.resolve ??= {};
8
- config.resolve.alias = {
9
- ...config.resolve.alias || {},
10
- [uiNative]: uiWeb,
11
- [presNative]: presReact
12
- };
13
- config.resolve.extensions = [
14
- ".web.js",
15
- ".web.jsx",
16
- ".web.ts",
17
- ".web.tsx",
18
- ...config.resolve.extensions || []
19
- ];
20
- return config;
4
+ const uiWeb = opts.uiKitWeb ?? "@contractspec/lib.ui-kit-web";
5
+ const uiNative = opts.uiKitNative ?? "@contractspec/lib.ui-kit";
6
+ const presReact = opts.presentationReact ?? "@contractspec/lib.presentation-runtime-react";
7
+ const presNative = opts.presentationNative ?? "@contractspec/lib.presentation-runtime-react-native";
8
+ config.resolve ??= {};
9
+ config.resolve.alias = {
10
+ ...config.resolve.alias || {},
11
+ [uiNative]: uiWeb,
12
+ [presNative]: presReact
13
+ };
14
+ config.resolve.extensions = [
15
+ ".web.js",
16
+ ".web.jsx",
17
+ ".web.ts",
18
+ ".web.tsx",
19
+ ...config.resolve.extensions || []
20
+ ];
21
+ return config;
21
22
  }
22
23
  function withPresentationMetroAliases(config, opts = {}) {
23
- const uiWeb = opts.uiKitWeb ?? "@contractspec/lib.ui-kit-web";
24
- const uiNative = opts.uiKitNative ?? "@contractspec/lib.ui-kit";
25
- const presReact = opts.presentationReact ?? "@contractspec/lib.presentation-runtime-react";
26
- const presNative = opts.presentationNative ?? "@contractspec/lib.presentation-runtime-react-native";
27
- config.resolver ??= {};
28
- config.resolver.unstable_enablePackageExports = true;
29
- config.resolver.platforms = [
30
- "ios",
31
- "android",
32
- "native",
33
- "mobile",
34
- "web",
35
- ...config.resolver.platforms || []
36
- ];
37
- const original = config.resolver.resolveRequest;
38
- config.resolver.resolveRequest = (ctx, moduleName, platform) => {
39
- if (platform === "ios" || platform === "android" || platform === "native") {
40
- if (typeof moduleName === "string" && moduleName.startsWith(uiWeb + "/ui")) {
41
- const mapped = moduleName.replace(uiWeb + "/ui", uiNative + "/ui");
42
- return (original ?? ctx.resolveRequest)(ctx, mapped, platform);
43
- }
44
- if (moduleName === presReact) return (original ?? ctx.resolveRequest)(ctx, presNative, platform);
45
- }
46
- return (original ?? ctx.resolveRequest)(ctx, moduleName, platform);
47
- };
48
- return config;
24
+ const uiWeb = opts.uiKitWeb ?? "@contractspec/lib.ui-kit-web";
25
+ const uiNative = opts.uiKitNative ?? "@contractspec/lib.ui-kit";
26
+ const presReact = opts.presentationReact ?? "@contractspec/lib.presentation-runtime-react";
27
+ const presNative = opts.presentationNative ?? "@contractspec/lib.presentation-runtime-react-native";
28
+ config.resolver ??= {};
29
+ config.resolver.unstable_enablePackageExports = true;
30
+ config.resolver.platforms = [
31
+ "ios",
32
+ "android",
33
+ "native",
34
+ "mobile",
35
+ "web",
36
+ ...config.resolver.platforms || []
37
+ ];
38
+ const original = config.resolver.resolveRequest;
39
+ config.resolver.resolveRequest = (ctx, moduleName, platform) => {
40
+ if (platform === "ios" || platform === "android" || platform === "native") {
41
+ if (typeof moduleName === "string" && moduleName.startsWith(uiWeb + "/ui")) {
42
+ const mapped = moduleName.replace(uiWeb + "/ui", uiNative + "/ui");
43
+ return (original ?? ctx.resolveRequest)(ctx, mapped, platform);
44
+ }
45
+ if (moduleName === presReact) {
46
+ return (original ?? ctx.resolveRequest)(ctx, presNative, platform);
47
+ }
48
+ }
49
+ return (original ?? ctx.resolveRequest)(ctx, moduleName, platform);
50
+ };
51
+ return config;
49
52
  }
50
-
51
- //#endregion
52
- export { withPresentationMetroAliases, withPresentationNextAliases };
53
- //# sourceMappingURL=index.js.map
53
+ export {
54
+ withPresentationNextAliases,
55
+ withPresentationMetroAliases
56
+ };
@@ -0,0 +1,55 @@
1
+ // src/index.ts
2
+ function withPresentationNextAliases(config, opts = {}) {
3
+ const uiWeb = opts.uiKitWeb ?? "@contractspec/lib.ui-kit-web";
4
+ const uiNative = opts.uiKitNative ?? "@contractspec/lib.ui-kit";
5
+ const presReact = opts.presentationReact ?? "@contractspec/lib.presentation-runtime-react";
6
+ const presNative = opts.presentationNative ?? "@contractspec/lib.presentation-runtime-react-native";
7
+ config.resolve ??= {};
8
+ config.resolve.alias = {
9
+ ...config.resolve.alias || {},
10
+ [uiNative]: uiWeb,
11
+ [presNative]: presReact
12
+ };
13
+ config.resolve.extensions = [
14
+ ".web.js",
15
+ ".web.jsx",
16
+ ".web.ts",
17
+ ".web.tsx",
18
+ ...config.resolve.extensions || []
19
+ ];
20
+ return config;
21
+ }
22
+ function withPresentationMetroAliases(config, opts = {}) {
23
+ const uiWeb = opts.uiKitWeb ?? "@contractspec/lib.ui-kit-web";
24
+ const uiNative = opts.uiKitNative ?? "@contractspec/lib.ui-kit";
25
+ const presReact = opts.presentationReact ?? "@contractspec/lib.presentation-runtime-react";
26
+ const presNative = opts.presentationNative ?? "@contractspec/lib.presentation-runtime-react-native";
27
+ config.resolver ??= {};
28
+ config.resolver.unstable_enablePackageExports = true;
29
+ config.resolver.platforms = [
30
+ "ios",
31
+ "android",
32
+ "native",
33
+ "mobile",
34
+ "web",
35
+ ...config.resolver.platforms || []
36
+ ];
37
+ const original = config.resolver.resolveRequest;
38
+ config.resolver.resolveRequest = (ctx, moduleName, platform) => {
39
+ if (platform === "ios" || platform === "android" || platform === "native") {
40
+ if (typeof moduleName === "string" && moduleName.startsWith(uiWeb + "/ui")) {
41
+ const mapped = moduleName.replace(uiWeb + "/ui", uiNative + "/ui");
42
+ return (original ?? ctx.resolveRequest)(ctx, mapped, platform);
43
+ }
44
+ if (moduleName === presReact) {
45
+ return (original ?? ctx.resolveRequest)(ctx, presNative, platform);
46
+ }
47
+ }
48
+ return (original ?? ctx.resolveRequest)(ctx, moduleName, platform);
49
+ };
50
+ return config;
51
+ }
52
+ export {
53
+ withPresentationNextAliases,
54
+ withPresentationMetroAliases
55
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/lib.presentation-runtime-core",
3
- "version": "1.57.0",
3
+ "version": "1.59.0",
4
4
  "description": "Core presentation runtime for contract-driven UIs",
5
5
  "keywords": [
6
6
  "contractspec",
@@ -16,38 +16,42 @@
16
16
  "scripts": {
17
17
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
18
18
  "publish:pkg:canary": "bun publish:pkg --tag canary",
19
- "build": "bun build:bundle && bun build:types",
20
- "build:bundle": "tsdown",
21
- "build:types": "tsc --noEmit -p tsconfig.json",
19
+ "build": "bun run prebuild && bun run build:bundle && bun run build:types",
20
+ "build:bundle": "contractspec-bun-build transpile",
21
+ "build:types": "contractspec-bun-build types",
22
22
  "clean": "rimraf dist .turbo",
23
- "dev": "bun run build:bundle --watch",
23
+ "dev": "contractspec-bun-build dev",
24
24
  "lint": "bun run lint:fix",
25
25
  "lint:fix": "eslint src --fix",
26
- "lint:check": "eslint src"
26
+ "lint:check": "eslint src",
27
+ "prebuild": "contractspec-bun-build prebuild",
28
+ "typecheck": "tsc --noEmit -p tsconfig.json"
27
29
  },
28
30
  "peerDependencies": {
29
31
  "typescript": "^5.9.0"
30
32
  },
31
33
  "devDependencies": {
32
- "@contractspec/tool.tsdown": "1.57.0",
33
- "@contractspec/tool.typescript": "1.57.0",
34
- "tsdown": "^0.20.3",
35
- "typescript": "^5.9.3"
34
+ "@contractspec/tool.typescript": "1.59.0",
35
+ "typescript": "^5.9.3",
36
+ "@contractspec/tool.bun": "1.58.0"
36
37
  },
37
38
  "files": [
38
39
  "dist",
39
40
  "README.md"
40
41
  ],
41
42
  "exports": {
42
- ".": "./dist/index.js",
43
- "./*": "./*"
43
+ ".": "./src/index.ts"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public",
47
47
  "exports": {
48
- ".": "./dist/index.js",
49
- "./metro.cjs": "./src/metro.cjs",
50
- "./next.mjs": "./src/next.mjs"
48
+ ".": {
49
+ "types": "./dist/index.d.ts",
50
+ "bun": "./dist/index.js",
51
+ "node": "./dist/node/index.mjs",
52
+ "browser": "./dist/browser/index.js",
53
+ "default": "./dist/index.js"
54
+ }
51
55
  },
52
56
  "registry": "https://registry.npmjs.org/"
53
57
  },
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export interface ListState<TFilters extends Record<string, unknown>> {\n q: string;\n page: number;\n limit: number;\n sort?: string | null;\n filters: TFilters;\n}\n\nexport type ListFetcher<TVars, TItem> = (\n vars: TVars\n) => Promise<{ items: TItem[]; totalItems?: number; totalPages?: number }>;\n\n// ---- Framework config helpers (Next / Metro) ----\nexport interface NextAliasOptions {\n uiKitWeb?: string; // default '@contractspec/lib.ui-kit-web'\n uiKitNative?: string; // default '@contractspec/lib.ui-kit'\n presentationReact?: string; // default '@contractspec/lib.presentation-runtime-react'\n presentationNative?: string; // default '@contractspec/lib.presentation-runtime-react-native'\n}\n\nexport function withPresentationNextAliases(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any,\n opts: NextAliasOptions = {}\n) {\n const uiWeb = opts.uiKitWeb ?? '@contractspec/lib.ui-kit-web';\n const uiNative = opts.uiKitNative ?? '@contractspec/lib.ui-kit';\n const presReact =\n opts.presentationReact ?? '@contractspec/lib.presentation-runtime-react';\n const presNative =\n opts.presentationNative ??\n '@contractspec/lib.presentation-runtime-react-native';\n\n config.resolve ??= {};\n config.resolve.alias = {\n ...(config.resolve.alias || {}),\n [uiNative]: uiWeb,\n [presNative]: presReact,\n };\n config.resolve.extensions = [\n '.web.js',\n '.web.jsx',\n '.web.ts',\n '.web.tsx',\n ...((config.resolve.extensions as string[]) || []),\n ];\n return config;\n}\n\nexport type MetroAliasOptions = NextAliasOptions & {\n monorepoRoot?: string;\n};\n\nexport function withPresentationMetroAliases(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any,\n opts: MetroAliasOptions = {}\n) {\n const uiWeb = opts.uiKitWeb ?? '@contractspec/lib.ui-kit-web';\n const uiNative = opts.uiKitNative ?? '@contractspec/lib.ui-kit';\n const presReact =\n opts.presentationReact ?? '@contractspec/lib.presentation-runtime-react';\n const presNative =\n opts.presentationNative ??\n '@contractspec/lib.presentation-runtime-react-native';\n\n // Prefer package exports resolution\n config.resolver ??= {};\n config.resolver.unstable_enablePackageExports = true;\n\n // Platform resolution ordering\n config.resolver.platforms = [\n 'ios',\n 'android',\n 'native',\n 'mobile',\n 'web',\n ...((config.resolver.platforms as string[]) || []),\n ];\n\n // Map web kit → native at resolver-level\n const original = config.resolver.resolveRequest;\n config.resolver.resolveRequest = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ctx: any,\n moduleName: string,\n platform: string\n ) => {\n if (platform === 'ios' || platform === 'android' || platform === 'native') {\n if (\n typeof moduleName === 'string' &&\n moduleName.startsWith(uiWeb + '/ui')\n ) {\n const mapped = moduleName.replace(uiWeb + '/ui', uiNative + '/ui');\n return (original ?? ctx.resolveRequest)(ctx, mapped, platform);\n }\n if (moduleName === presReact) {\n return (original ?? ctx.resolveRequest)(ctx, presNative, platform);\n }\n }\n return (original ?? ctx.resolveRequest)(ctx, moduleName, platform);\n };\n\n return config;\n}\n"],"mappings":";AAoBA,SAAgB,4BAEd,QACA,OAAyB,EAAE,EAC3B;CACA,MAAM,QAAQ,KAAK,YAAY;CAC/B,MAAM,WAAW,KAAK,eAAe;CACrC,MAAM,YACJ,KAAK,qBAAqB;CAC5B,MAAM,aACJ,KAAK,sBACL;AAEF,QAAO,YAAY,EAAE;AACrB,QAAO,QAAQ,QAAQ;EACrB,GAAI,OAAO,QAAQ,SAAS,EAAE;GAC7B,WAAW;GACX,aAAa;EACf;AACD,QAAO,QAAQ,aAAa;EAC1B;EACA;EACA;EACA;EACA,GAAK,OAAO,QAAQ,cAA2B,EAAE;EAClD;AACD,QAAO;;AAOT,SAAgB,6BAEd,QACA,OAA0B,EAAE,EAC5B;CACA,MAAM,QAAQ,KAAK,YAAY;CAC/B,MAAM,WAAW,KAAK,eAAe;CACrC,MAAM,YACJ,KAAK,qBAAqB;CAC5B,MAAM,aACJ,KAAK,sBACL;AAGF,QAAO,aAAa,EAAE;AACtB,QAAO,SAAS,gCAAgC;AAGhD,QAAO,SAAS,YAAY;EAC1B;EACA;EACA;EACA;EACA;EACA,GAAK,OAAO,SAAS,aAA0B,EAAE;EAClD;CAGD,MAAM,WAAW,OAAO,SAAS;AACjC,QAAO,SAAS,kBAEd,KACA,YACA,aACG;AACH,MAAI,aAAa,SAAS,aAAa,aAAa,aAAa,UAAU;AACzE,OACE,OAAO,eAAe,YACtB,WAAW,WAAW,QAAQ,MAAM,EACpC;IACA,MAAM,SAAS,WAAW,QAAQ,QAAQ,OAAO,WAAW,MAAM;AAClE,YAAQ,YAAY,IAAI,gBAAgB,KAAK,QAAQ,SAAS;;AAEhE,OAAI,eAAe,UACjB,SAAQ,YAAY,IAAI,gBAAgB,KAAK,YAAY,SAAS;;AAGtE,UAAQ,YAAY,IAAI,gBAAgB,KAAK,YAAY,SAAS;;AAGpE,QAAO"}