@tyndall/build 0.0.8 → 0.0.10
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/dist/build.d.ts.map +1 -1
- package/dist/build.js +26 -0
- package/package.json +3 -3
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/build.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { copyFile, mkdir, rm, stat, writeFile } from "node:fs/promises";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
import { dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
3
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
5
|
import { createRouteGraph, loadConfig, resolveLayoutRouteId, routeDataKeyForLayout, routeDataKeyForPage, ROUTE_DATA_ERROR_KEY, ROUTE_DATA_INIT_KEY, SPECIAL_ROUTE_IDS, collectRouteLayouts, renderClientRouterBootstrap, resolvePageModule, resolveUIAdapter, runBeforeBundleHooks, runGetRouteData, runInitServer, serializeProps, } from "@tyndall/core";
|
|
@@ -529,6 +530,29 @@ const emitBundleAssets = async (bundle, outDir, assetsDir, chunkSource) => {
|
|
|
529
530
|
await writeFileSafe(filePath, chunkSource);
|
|
530
531
|
}
|
|
531
532
|
};
|
|
533
|
+
const patchRequireLikeForVanillaExtract = () => {
|
|
534
|
+
if (typeof globalThis.Bun === "undefined") {
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
try {
|
|
538
|
+
const requireFn = createRequire(import.meta.url);
|
|
539
|
+
const resolved = requireFn.resolve("require-like");
|
|
540
|
+
const cached = requireFn.cache?.[resolved];
|
|
541
|
+
const original = requireFn("require-like");
|
|
542
|
+
if (original.__hyperPatched) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const patched = ((path) => createRequire(path));
|
|
546
|
+
Object.assign(patched, original);
|
|
547
|
+
patched.__hyperPatched = true;
|
|
548
|
+
if (cached) {
|
|
549
|
+
cached.exports = patched;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
catch {
|
|
553
|
+
// Best-effort patch for Bun require-like compatibility.
|
|
554
|
+
}
|
|
555
|
+
};
|
|
532
556
|
const buildChunkFile = async (entryPath, outputPath, options) => {
|
|
533
557
|
const bundlerPlugins = options.plugins ?? [];
|
|
534
558
|
const shouldEmitCss = Boolean(options.emitCss && options.cssOutputPath);
|
|
@@ -554,6 +578,7 @@ const buildChunkFile = async (entryPath, outputPath, options) => {
|
|
|
554
578
|
: null;
|
|
555
579
|
const selectedBundler = options.syntaxTarget === "es5" ? "esbuild" : options.bundler ?? "bun";
|
|
556
580
|
if (selectedBundler === "esbuild") {
|
|
581
|
+
patchRequireLikeForVanillaExtract();
|
|
557
582
|
const tempOutDir = join(dirname(outputPath), `.@tyndall/esbuild-tmp-${hash(`${outputPath}-${Date.now()}`)}`);
|
|
558
583
|
try {
|
|
559
584
|
await mkdir(tempOutDir, { recursive: true });
|
|
@@ -735,6 +760,7 @@ const findDynamicImportModules = async (modulePaths) => {
|
|
|
735
760
|
};
|
|
736
761
|
export const build = async (options) => {
|
|
737
762
|
const rootDir = options.rootDir;
|
|
763
|
+
patchRequireLikeForVanillaExtract();
|
|
738
764
|
const config = await loadConfig(rootDir);
|
|
739
765
|
const routesDir = resolvePath(rootDir, options.routesDir ?? config.routesDir);
|
|
740
766
|
const publicDir = resolvePath(rootDir, options.publicDir ?? config.publicDir);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tyndall/build",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
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.
|
|
26
|
-
"@tyndall/shared": "^0.0.
|
|
25
|
+
"@tyndall/core": "^0.0.10",
|
|
26
|
+
"@tyndall/shared": "^0.0.10",
|
|
27
27
|
"esbuild": "0.21.5"
|
|
28
28
|
}
|
|
29
29
|
}
|