@tyndall/build 0.0.12 → 0.0.14

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.
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,QAAQ,EAIR,UAAU,EAMV,iBAAiB,EAClB,MAAM,eAAe,CAAC;AA+DvB,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAExE,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,KAAK,CAAC;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACnC,eAAe,CAAC,EAAE,iBAAiB,CAAC;CACrC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAi7BD,eAAO,MAAM,KAAK,GAAU,SAAS,YAAY,KAAG,OAAO,CAAC,WAAW,CAk6CtE,CAAC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,QAAQ,EAIR,UAAU,EAMV,iBAAiB,EAClB,MAAM,eAAe,CAAC;AA+DvB,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAExE,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,KAAK,CAAC;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACnC,eAAe,CAAC,EAAE,iBAAiB,CAAC;CACrC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAo9BD,eAAO,MAAM,KAAK,GAAU,SAAS,YAAY,KAAG,OAAO,CAAC,WAAW,CAk6CtE,CAAC"}
package/dist/build.js CHANGED
@@ -468,6 +468,7 @@ const getBunBuildApi = () => {
468
468
  return { build: runtime.Bun.build };
469
469
  };
470
470
  let hyperCoreBrowserShimSource = null;
471
+ let hyperReactClientPath = null;
471
472
  const resolveCoreShimModulePath = async (entryDir, moduleName) => {
472
473
  const candidates = [
473
474
  `${moduleName}.js`,
@@ -505,6 +506,7 @@ const resolveHyperCoreBrowserShimSource = async () => {
505
506
  const renderPolicyPath = await resolveCoreShimModulePath(entryDir, "render-policy");
506
507
  const resolverFallbackPath = await resolveCoreShimModulePath(entryDir, "resolver-fallback");
507
508
  const routeDataPath = await resolveCoreShimModulePath(entryDir, "route-data");
509
+ const clientPath = await resolveCoreShimModulePath(entryDir, "client");
508
510
  hyperCoreBrowserShimSource = {
509
511
  source: [
510
512
  `export { mergeHeadDescriptors } from ${JSON.stringify(headPath)};`,
@@ -521,9 +523,26 @@ const resolveHyperCoreBrowserShimSource = async () => {
521
523
  ].join("\n"),
522
524
  // Required so esbuild resolves filesystem imports from a virtual namespace.
523
525
  resolveDir: entryDir,
526
+ clientPath,
524
527
  };
525
528
  return hyperCoreBrowserShimSource;
526
529
  };
530
+ const resolveHyperReactClientPath = async () => {
531
+ if (hyperReactClientPath) {
532
+ return hyperReactClientPath;
533
+ }
534
+ const resolver = import.meta;
535
+ if (typeof resolver.resolve !== "function") {
536
+ throw new Error("import.meta.resolve is unavailable while building react browser entries.");
537
+ }
538
+ const resolvedEntry = await resolver.resolve("@tyndall/react");
539
+ const entryPath = resolvedEntry.startsWith("file://")
540
+ ? fileURLToPath(resolvedEntry)
541
+ : resolvedEntry;
542
+ const entryDir = dirname(entryPath);
543
+ hyperReactClientPath = await resolveCoreShimModulePath(entryDir, "client");
544
+ return hyperReactClientPath;
545
+ };
527
546
  const emitBundleAssets = async (bundle, outDir, assetsDir, chunkSource) => {
528
547
  for (const chunk of Object.values(bundle.chunks)) {
529
548
  const filePath = join(outDir, assetsDir, chunk.file);
@@ -557,6 +576,7 @@ const buildChunkFile = async (entryPath, outputPath, options) => {
557
576
  const bundlerPlugins = options.plugins ?? [];
558
577
  const shouldEmitCss = Boolean(options.emitCss && options.cssOutputPath);
559
578
  const shimSource = options.shimHyperCore ? await resolveHyperCoreBrowserShimSource() : null;
579
+ const reactClientPath = options.shimHyperCore ? await resolveHyperReactClientPath() : null;
560
580
  const shimPlugin = shimSource
561
581
  ? {
562
582
  name: "@tyndall/core-browser-shim",
@@ -565,6 +585,17 @@ const buildChunkFile = async (entryPath, outputPath, options) => {
565
585
  path: "@tyndall/core-browser-shim",
566
586
  namespace: "@tyndall/core-browser-shim",
567
587
  }));
588
+ build.onResolve({ filter: /^@tyndall\/core\/client$/ }, () => ({
589
+ path: shimSource.clientPath,
590
+ }));
591
+ if (reactClientPath) {
592
+ build.onResolve({ filter: /^@tyndall\/react$/ }, () => ({
593
+ path: reactClientPath,
594
+ }));
595
+ build.onResolve({ filter: /^@tyndall\/react\/client$/ }, () => ({
596
+ path: reactClientPath,
597
+ }));
598
+ }
568
599
  build.onLoad({
569
600
  filter: /^@tyndall\/core-browser-shim$/,
570
601
  namespace: "@tyndall/core-browser-shim",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tyndall/build",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@swc/core": "^1.15.17",
25
- "@tyndall/core": "^0.0.12",
26
- "@tyndall/shared": "^0.0.12",
25
+ "@tyndall/core": "^0.0.14",
26
+ "@tyndall/shared": "^0.0.14",
27
27
  "esbuild": "0.21.5"
28
28
  }
29
29
  }