@tyndall/build 0.0.5 → 0.0.7
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 +30 -11
- 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":"AAGA,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;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAGA,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;AAm3BD,eAAO,MAAM,KAAK,GAAU,SAAS,YAAY,KAAG,OAAO,CAAC,WAAW,CAi6CtE,CAAC"}
|
package/dist/build.js
CHANGED
|
@@ -552,7 +552,8 @@ const buildChunkFile = async (entryPath, outputPath, options) => {
|
|
|
552
552
|
},
|
|
553
553
|
}
|
|
554
554
|
: null;
|
|
555
|
-
|
|
555
|
+
const selectedBundler = options.syntaxTarget === "es5" ? "esbuild" : options.bundler ?? "bun";
|
|
556
|
+
if (selectedBundler === "esbuild") {
|
|
556
557
|
try {
|
|
557
558
|
const plugins = shimPlugin ? [shimPlugin, ...bundlerPlugins] : [...bundlerPlugins];
|
|
558
559
|
const bundled = await esbuild({
|
|
@@ -560,7 +561,7 @@ const buildChunkFile = async (entryPath, outputPath, options) => {
|
|
|
560
561
|
bundle: true,
|
|
561
562
|
platform: options.target === "node" ? "node" : "browser",
|
|
562
563
|
format: options.format,
|
|
563
|
-
target: "es2015",
|
|
564
|
+
target: options.syntaxTarget === "es5" ? "es2015" : options.esbuildTarget ?? "esnext",
|
|
564
565
|
splitting: false,
|
|
565
566
|
sourcemap: false,
|
|
566
567
|
minify: false,
|
|
@@ -576,15 +577,17 @@ const buildChunkFile = async (entryPath, outputPath, options) => {
|
|
|
576
577
|
if (!outputText) {
|
|
577
578
|
throw new Error("ES5 bundling produced no output.");
|
|
578
579
|
}
|
|
579
|
-
const transformed =
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
580
|
+
const transformed = options.syntaxTarget === "es5"
|
|
581
|
+
? await transform(outputText, {
|
|
582
|
+
jsc: {
|
|
583
|
+
target: "es5",
|
|
584
|
+
parser: {
|
|
585
|
+
syntax: "ecmascript",
|
|
586
|
+
},
|
|
584
587
|
},
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
+
sourceMaps: false,
|
|
589
|
+
})
|
|
590
|
+
: { code: outputText };
|
|
588
591
|
await mkdir(dirname(outputPath), { recursive: true });
|
|
589
592
|
await writeFile(outputPath, transformed.code, "utf-8");
|
|
590
593
|
if (shouldEmitCss && options.cssOutputPath) {
|
|
@@ -728,6 +731,7 @@ export const build = async (options) => {
|
|
|
728
731
|
const legacyBootstrapChunk = renderLegacyClientBootstrap();
|
|
729
732
|
const legacyEnabled = config.legacy.enabled;
|
|
730
733
|
const modernTarget = config.target;
|
|
734
|
+
const modernBundler = config.bundler === "esbuild" ? "esbuild" : "bun";
|
|
731
735
|
const isEs5Target = modernTarget === "es5";
|
|
732
736
|
const clientScriptType = isEs5Target ? "classic" : "module";
|
|
733
737
|
const serverTarget = "es2018";
|
|
@@ -1313,6 +1317,9 @@ export const build = async (options) => {
|
|
|
1313
1317
|
return collectStaticData(routeGraph, pageModules, staticDataCache);
|
|
1314
1318
|
},
|
|
1315
1319
|
renderHtml: async (_ctx, state) => {
|
|
1320
|
+
if (mode === "ssr" && config.render.mode === "ssr") {
|
|
1321
|
+
return {};
|
|
1322
|
+
}
|
|
1316
1323
|
if (!state.staticData || typeof state.staticData !== "object") {
|
|
1317
1324
|
return {};
|
|
1318
1325
|
}
|
|
@@ -1600,7 +1607,7 @@ export const build = async (options) => {
|
|
|
1600
1607
|
target: input.target,
|
|
1601
1608
|
format: input.format,
|
|
1602
1609
|
syntaxTarget: input.syntaxTarget,
|
|
1603
|
-
bundler: input.syntaxTarget === "es5" ? "esbuild" :
|
|
1610
|
+
bundler: input.syntaxTarget === "es5" ? "esbuild" : modernBundler,
|
|
1604
1611
|
bundleType: input.bundleType,
|
|
1605
1612
|
bundlerPlugins: plugins,
|
|
1606
1613
|
addBundlerPlugin: (plugin) => {
|
|
@@ -1696,6 +1703,8 @@ export const build = async (options) => {
|
|
|
1696
1703
|
format: clientScriptType === "classic" ? "iife" : "esm",
|
|
1697
1704
|
shimHyperCore: true,
|
|
1698
1705
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1706
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1707
|
+
esbuildTarget: isEs5Target ? undefined : modernTarget,
|
|
1699
1708
|
plugins: bundlerPlugins,
|
|
1700
1709
|
emitCss: Boolean(cssOutputPath),
|
|
1701
1710
|
cssOutputPath,
|
|
@@ -1723,6 +1732,8 @@ export const build = async (options) => {
|
|
|
1723
1732
|
format: clientScriptType === "classic" ? "iife" : "esm",
|
|
1724
1733
|
shimHyperCore: true,
|
|
1725
1734
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1735
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1736
|
+
esbuildTarget: isEs5Target ? undefined : modernTarget,
|
|
1726
1737
|
plugins: bundlerPlugins,
|
|
1727
1738
|
emitCss: Boolean(cssOutputPath),
|
|
1728
1739
|
cssOutputPath,
|
|
@@ -1751,6 +1762,8 @@ export const build = async (options) => {
|
|
|
1751
1762
|
format: clientScriptType === "classic" ? "iife" : "esm",
|
|
1752
1763
|
shimHyperCore: true,
|
|
1753
1764
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1765
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1766
|
+
esbuildTarget: isEs5Target ? undefined : modernTarget,
|
|
1754
1767
|
plugins: bundlerPlugins,
|
|
1755
1768
|
emitCss: Boolean(cssOutputPath),
|
|
1756
1769
|
cssOutputPath,
|
|
@@ -1781,6 +1794,8 @@ export const build = async (options) => {
|
|
|
1781
1794
|
format: "cjs",
|
|
1782
1795
|
shimHyperCore: false,
|
|
1783
1796
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1797
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1798
|
+
esbuildTarget: isEs5Target ? undefined : serverTarget,
|
|
1784
1799
|
plugins: bundlerPlugins,
|
|
1785
1800
|
});
|
|
1786
1801
|
}
|
|
@@ -1802,6 +1817,8 @@ export const build = async (options) => {
|
|
|
1802
1817
|
format: "cjs",
|
|
1803
1818
|
shimHyperCore: false,
|
|
1804
1819
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1820
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1821
|
+
esbuildTarget: isEs5Target ? undefined : serverTarget,
|
|
1805
1822
|
plugins: bundlerPlugins,
|
|
1806
1823
|
});
|
|
1807
1824
|
}
|
|
@@ -1824,6 +1841,8 @@ export const build = async (options) => {
|
|
|
1824
1841
|
format: "cjs",
|
|
1825
1842
|
shimHyperCore: false,
|
|
1826
1843
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1844
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1845
|
+
esbuildTarget: isEs5Target ? undefined : serverTarget,
|
|
1827
1846
|
plugins: bundlerPlugins,
|
|
1828
1847
|
});
|
|
1829
1848
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tyndall/build",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
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.7",
|
|
26
|
+
"@tyndall/shared": "^0.0.7",
|
|
27
27
|
"esbuild": "0.21.5"
|
|
28
28
|
}
|
|
29
29
|
}
|