@tyndall/build 0.0.6 → 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 +27 -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";
|
|
@@ -1603,7 +1607,7 @@ export const build = async (options) => {
|
|
|
1603
1607
|
target: input.target,
|
|
1604
1608
|
format: input.format,
|
|
1605
1609
|
syntaxTarget: input.syntaxTarget,
|
|
1606
|
-
bundler: input.syntaxTarget === "es5" ? "esbuild" :
|
|
1610
|
+
bundler: input.syntaxTarget === "es5" ? "esbuild" : modernBundler,
|
|
1607
1611
|
bundleType: input.bundleType,
|
|
1608
1612
|
bundlerPlugins: plugins,
|
|
1609
1613
|
addBundlerPlugin: (plugin) => {
|
|
@@ -1699,6 +1703,8 @@ export const build = async (options) => {
|
|
|
1699
1703
|
format: clientScriptType === "classic" ? "iife" : "esm",
|
|
1700
1704
|
shimHyperCore: true,
|
|
1701
1705
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1706
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1707
|
+
esbuildTarget: isEs5Target ? undefined : modernTarget,
|
|
1702
1708
|
plugins: bundlerPlugins,
|
|
1703
1709
|
emitCss: Boolean(cssOutputPath),
|
|
1704
1710
|
cssOutputPath,
|
|
@@ -1726,6 +1732,8 @@ export const build = async (options) => {
|
|
|
1726
1732
|
format: clientScriptType === "classic" ? "iife" : "esm",
|
|
1727
1733
|
shimHyperCore: true,
|
|
1728
1734
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1735
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1736
|
+
esbuildTarget: isEs5Target ? undefined : modernTarget,
|
|
1729
1737
|
plugins: bundlerPlugins,
|
|
1730
1738
|
emitCss: Boolean(cssOutputPath),
|
|
1731
1739
|
cssOutputPath,
|
|
@@ -1754,6 +1762,8 @@ export const build = async (options) => {
|
|
|
1754
1762
|
format: clientScriptType === "classic" ? "iife" : "esm",
|
|
1755
1763
|
shimHyperCore: true,
|
|
1756
1764
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1765
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1766
|
+
esbuildTarget: isEs5Target ? undefined : modernTarget,
|
|
1757
1767
|
plugins: bundlerPlugins,
|
|
1758
1768
|
emitCss: Boolean(cssOutputPath),
|
|
1759
1769
|
cssOutputPath,
|
|
@@ -1784,6 +1794,8 @@ export const build = async (options) => {
|
|
|
1784
1794
|
format: "cjs",
|
|
1785
1795
|
shimHyperCore: false,
|
|
1786
1796
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1797
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1798
|
+
esbuildTarget: isEs5Target ? undefined : serverTarget,
|
|
1787
1799
|
plugins: bundlerPlugins,
|
|
1788
1800
|
});
|
|
1789
1801
|
}
|
|
@@ -1805,6 +1817,8 @@ export const build = async (options) => {
|
|
|
1805
1817
|
format: "cjs",
|
|
1806
1818
|
shimHyperCore: false,
|
|
1807
1819
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1820
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1821
|
+
esbuildTarget: isEs5Target ? undefined : serverTarget,
|
|
1808
1822
|
plugins: bundlerPlugins,
|
|
1809
1823
|
});
|
|
1810
1824
|
}
|
|
@@ -1827,6 +1841,8 @@ export const build = async (options) => {
|
|
|
1827
1841
|
format: "cjs",
|
|
1828
1842
|
shimHyperCore: false,
|
|
1829
1843
|
syntaxTarget: isEs5Target ? "es5" : "modern",
|
|
1844
|
+
bundler: isEs5Target ? "esbuild" : modernBundler,
|
|
1845
|
+
esbuildTarget: isEs5Target ? undefined : serverTarget,
|
|
1830
1846
|
plugins: bundlerPlugins,
|
|
1831
1847
|
});
|
|
1832
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
|
}
|