@utoo/pack 1.4.0-alpha.1 → 1.4.0-alpha.2
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/cjs/binding.d.ts +2 -0
- package/cjs/commands/build.js +7 -6
- package/cjs/core/hmr.js +5 -4
- package/esm/binding.d.ts +2 -0
- package/esm/commands/build.js +7 -6
- package/esm/core/hmr.js +5 -4
- package/package.json +9 -9
package/cjs/binding.d.ts
CHANGED
package/cjs/commands/build.js
CHANGED
|
@@ -29,7 +29,7 @@ function build(options, projectPath, rootPath) {
|
|
|
29
29
|
return buildInternal(bundleOptions, projectPath, rootPath);
|
|
30
30
|
}
|
|
31
31
|
async function buildInternal(bundleOptions, projectPath, rootPath) {
|
|
32
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
32
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
33
33
|
(0, common_1.blockStdout)();
|
|
34
34
|
if (process.env.XCODE_PROFILE) {
|
|
35
35
|
await (0, xcodeProfile_1.xcodeProfilingReady)();
|
|
@@ -46,18 +46,19 @@ async function buildInternal(bundleOptions, projectPath, rootPath) {
|
|
|
46
46
|
},
|
|
47
47
|
dev: (_b = bundleOptions.dev) !== null && _b !== void 0 ? _b : false,
|
|
48
48
|
buildId: bundleOptions.buildId || (0, nanoid_1.nanoid)(),
|
|
49
|
+
tracing: (_c = bundleOptions.tracing) !== null && _c !== void 0 ? _c : true,
|
|
49
50
|
config: {
|
|
50
51
|
...bundleOptions.config,
|
|
51
52
|
stats: Boolean(process.env.ANALYZE) ||
|
|
52
53
|
bundleOptions.config.stats ||
|
|
53
54
|
bundleOptions.config.entry.some((e) => !!e.html),
|
|
54
|
-
pluginRuntimeStrategy: (
|
|
55
|
+
pluginRuntimeStrategy: (_e = (_d = bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.config) === null || _d === void 0 ? void 0 : _d.pluginRuntimeStrategy) !== null && _e !== void 0 ? _e : ((0, runtimePluginStratety_1.useWorkerThreads)() ? "workerThreads" : "childProcesses"),
|
|
55
56
|
},
|
|
56
57
|
projectPath: (0, normalize_path_1.normalizePath)(resolvedProjectPath),
|
|
57
58
|
rootPath: resolvedRootPath,
|
|
58
59
|
packPath: (0, common_1.getPackPath)(),
|
|
59
60
|
}, {
|
|
60
|
-
persistentCaching: (
|
|
61
|
+
persistentCaching: (_f = bundleOptions.config.persistentCaching) !== null && _f !== void 0 ? _f : false,
|
|
61
62
|
});
|
|
62
63
|
const entrypoints = await project.writeAllEntrypointsToDisk();
|
|
63
64
|
(0, pack_shared_1.handleIssues)(entrypoints.issues);
|
|
@@ -73,20 +74,20 @@ async function buildInternal(bundleOptions, projectPath, rootPath) {
|
|
|
73
74
|
];
|
|
74
75
|
if (htmlConfigs.length > 0) {
|
|
75
76
|
const assets = { js: [], css: [] };
|
|
76
|
-
const outputDir = ((
|
|
77
|
+
const outputDir = ((_g = bundleOptions.config.output) === null || _g === void 0 ? void 0 : _g.path) || path_1.default.join(process.cwd(), "dist");
|
|
77
78
|
if (assets.js.length === 0 && assets.css.length === 0) {
|
|
78
79
|
const discovered = (0, getInitialAssets_1.getInitialAssetsFromStats)(outputDir);
|
|
79
80
|
assets.js.push(...discovered.js);
|
|
80
81
|
assets.css.push(...discovered.css);
|
|
81
82
|
}
|
|
82
|
-
const publicPath = (
|
|
83
|
+
const publicPath = (_h = bundleOptions.config.output) === null || _h === void 0 ? void 0 : _h.publicPath;
|
|
83
84
|
for (const config of htmlConfigs) {
|
|
84
85
|
const plugin = new HtmlPlugin_1.HtmlPlugin(config);
|
|
85
86
|
await plugin.generate(outputDir, assets, publicPath);
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
if (process.env.ANALYZE) {
|
|
89
|
-
await analyzeBundle(((
|
|
90
|
+
await analyzeBundle(((_j = bundleOptions.config.output) === null || _j === void 0 ? void 0 : _j.path) || "dist");
|
|
90
91
|
}
|
|
91
92
|
await project.shutdown();
|
|
92
93
|
// TODO: Maybe run tasks in worker is a better way, see
|
package/cjs/core/hmr.js
CHANGED
|
@@ -24,7 +24,7 @@ var pack_shared_2 = require("@utoo/pack-shared");
|
|
|
24
24
|
Object.defineProperty(exports, "HMR_ACTIONS_SENT_TO_BROWSER", { enumerable: true, get: function () { return pack_shared_2.HMR_ACTIONS_SENT_TO_BROWSER; } });
|
|
25
25
|
exports.FAST_REFRESH_RUNTIME_RELOAD = "Fast Refresh had to perform a full reload due to a runtime error.";
|
|
26
26
|
async function createHotReloader(bundleOptions, projectPath, rootPath) {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f;
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
28
28
|
const resolvedProjectPath = projectPath || process.cwd();
|
|
29
29
|
const resolvedRootPath = rootPath || projectPath || process.cwd();
|
|
30
30
|
(0, htmlEntry_1.processHtmlEntry)(bundleOptions.config, resolvedProjectPath);
|
|
@@ -37,6 +37,7 @@ async function createHotReloader(bundleOptions, projectPath, rootPath) {
|
|
|
37
37
|
},
|
|
38
38
|
dev: true,
|
|
39
39
|
buildId: bundleOptions.buildId || (0, nanoid_1.nanoid)(),
|
|
40
|
+
tracing: (_b = bundleOptions.tracing) !== null && _b !== void 0 ? _b : true,
|
|
40
41
|
config: {
|
|
41
42
|
...bundleOptions.config,
|
|
42
43
|
mode: "development",
|
|
@@ -48,14 +49,14 @@ async function createHotReloader(bundleOptions, projectPath, rootPath) {
|
|
|
48
49
|
minify: false,
|
|
49
50
|
moduleIds: "named",
|
|
50
51
|
},
|
|
51
|
-
persistentCaching: (
|
|
52
|
-
pluginRuntimeStrategy: (
|
|
52
|
+
persistentCaching: (_d = (_c = bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.config) === null || _c === void 0 ? void 0 : _c.persistentCaching) !== null && _d !== void 0 ? _d : true,
|
|
53
|
+
pluginRuntimeStrategy: (_f = (_e = bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.config) === null || _e === void 0 ? void 0 : _e.pluginRuntimeStrategy) !== null && _f !== void 0 ? _f : ((0, runtimePluginStratety_1.useWorkerThreads)() ? "workerThreads" : "childProcesses"),
|
|
53
54
|
},
|
|
54
55
|
projectPath: (0, normalize_path_1.normalizePath)(resolvedProjectPath),
|
|
55
56
|
rootPath: resolvedRootPath,
|
|
56
57
|
packPath: (0, common_1.getPackPath)(),
|
|
57
58
|
}, {
|
|
58
|
-
persistentCaching: (
|
|
59
|
+
persistentCaching: (_g = bundleOptions.config.persistentCaching) !== null && _g !== void 0 ? _g : false,
|
|
59
60
|
});
|
|
60
61
|
const entrypointsSubscription = project.entrypointsSubscribe();
|
|
61
62
|
let currentEntriesHandlingResolve;
|
package/esm/binding.d.ts
CHANGED
package/esm/commands/build.js
CHANGED
|
@@ -23,7 +23,7 @@ export function build(options, projectPath, rootPath) {
|
|
|
23
23
|
return buildInternal(bundleOptions, projectPath, rootPath);
|
|
24
24
|
}
|
|
25
25
|
async function buildInternal(bundleOptions, projectPath, rootPath) {
|
|
26
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
27
27
|
blockStdout();
|
|
28
28
|
if (process.env.XCODE_PROFILE) {
|
|
29
29
|
await xcodeProfilingReady();
|
|
@@ -40,18 +40,19 @@ async function buildInternal(bundleOptions, projectPath, rootPath) {
|
|
|
40
40
|
},
|
|
41
41
|
dev: (_b = bundleOptions.dev) !== null && _b !== void 0 ? _b : false,
|
|
42
42
|
buildId: bundleOptions.buildId || nanoid(),
|
|
43
|
+
tracing: (_c = bundleOptions.tracing) !== null && _c !== void 0 ? _c : true,
|
|
43
44
|
config: {
|
|
44
45
|
...bundleOptions.config,
|
|
45
46
|
stats: Boolean(process.env.ANALYZE) ||
|
|
46
47
|
bundleOptions.config.stats ||
|
|
47
48
|
bundleOptions.config.entry.some((e) => !!e.html),
|
|
48
|
-
pluginRuntimeStrategy: (
|
|
49
|
+
pluginRuntimeStrategy: (_e = (_d = bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.config) === null || _d === void 0 ? void 0 : _d.pluginRuntimeStrategy) !== null && _e !== void 0 ? _e : (useWorkerThreads() ? "workerThreads" : "childProcesses"),
|
|
49
50
|
},
|
|
50
51
|
projectPath: normalizePath(resolvedProjectPath),
|
|
51
52
|
rootPath: resolvedRootPath,
|
|
52
53
|
packPath: getPackPath(),
|
|
53
54
|
}, {
|
|
54
|
-
persistentCaching: (
|
|
55
|
+
persistentCaching: (_f = bundleOptions.config.persistentCaching) !== null && _f !== void 0 ? _f : false,
|
|
55
56
|
});
|
|
56
57
|
const entrypoints = await project.writeAllEntrypointsToDisk();
|
|
57
58
|
handleIssues(entrypoints.issues);
|
|
@@ -67,20 +68,20 @@ async function buildInternal(bundleOptions, projectPath, rootPath) {
|
|
|
67
68
|
];
|
|
68
69
|
if (htmlConfigs.length > 0) {
|
|
69
70
|
const assets = { js: [], css: [] };
|
|
70
|
-
const outputDir = ((
|
|
71
|
+
const outputDir = ((_g = bundleOptions.config.output) === null || _g === void 0 ? void 0 : _g.path) || path.join(process.cwd(), "dist");
|
|
71
72
|
if (assets.js.length === 0 && assets.css.length === 0) {
|
|
72
73
|
const discovered = getInitialAssetsFromStats(outputDir);
|
|
73
74
|
assets.js.push(...discovered.js);
|
|
74
75
|
assets.css.push(...discovered.css);
|
|
75
76
|
}
|
|
76
|
-
const publicPath = (
|
|
77
|
+
const publicPath = (_h = bundleOptions.config.output) === null || _h === void 0 ? void 0 : _h.publicPath;
|
|
77
78
|
for (const config of htmlConfigs) {
|
|
78
79
|
const plugin = new HtmlPlugin(config);
|
|
79
80
|
await plugin.generate(outputDir, assets, publicPath);
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
if (process.env.ANALYZE) {
|
|
83
|
-
await analyzeBundle(((
|
|
84
|
+
await analyzeBundle(((_j = bundleOptions.config.output) === null || _j === void 0 ? void 0 : _j.path) || "dist");
|
|
84
85
|
}
|
|
85
86
|
await project.shutdown();
|
|
86
87
|
// TODO: Maybe run tasks in worker is a better way, see
|
package/esm/core/hmr.js
CHANGED
|
@@ -16,7 +16,7 @@ const sessionId = Math.floor(Number.MAX_SAFE_INTEGER * Math.random());
|
|
|
16
16
|
export { HMR_ACTIONS_SENT_TO_BROWSER, } from "@utoo/pack-shared";
|
|
17
17
|
export const FAST_REFRESH_RUNTIME_RELOAD = "Fast Refresh had to perform a full reload due to a runtime error.";
|
|
18
18
|
export async function createHotReloader(bundleOptions, projectPath, rootPath) {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f;
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
20
20
|
const resolvedProjectPath = projectPath || process.cwd();
|
|
21
21
|
const resolvedRootPath = rootPath || projectPath || process.cwd();
|
|
22
22
|
processHtmlEntry(bundleOptions.config, resolvedProjectPath);
|
|
@@ -29,6 +29,7 @@ export async function createHotReloader(bundleOptions, projectPath, rootPath) {
|
|
|
29
29
|
},
|
|
30
30
|
dev: true,
|
|
31
31
|
buildId: bundleOptions.buildId || nanoid(),
|
|
32
|
+
tracing: (_b = bundleOptions.tracing) !== null && _b !== void 0 ? _b : true,
|
|
32
33
|
config: {
|
|
33
34
|
...bundleOptions.config,
|
|
34
35
|
mode: "development",
|
|
@@ -40,14 +41,14 @@ export async function createHotReloader(bundleOptions, projectPath, rootPath) {
|
|
|
40
41
|
minify: false,
|
|
41
42
|
moduleIds: "named",
|
|
42
43
|
},
|
|
43
|
-
persistentCaching: (
|
|
44
|
-
pluginRuntimeStrategy: (
|
|
44
|
+
persistentCaching: (_d = (_c = bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.config) === null || _c === void 0 ? void 0 : _c.persistentCaching) !== null && _d !== void 0 ? _d : true,
|
|
45
|
+
pluginRuntimeStrategy: (_f = (_e = bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.config) === null || _e === void 0 ? void 0 : _e.pluginRuntimeStrategy) !== null && _f !== void 0 ? _f : (useWorkerThreads() ? "workerThreads" : "childProcesses"),
|
|
45
46
|
},
|
|
46
47
|
projectPath: normalizePath(resolvedProjectPath),
|
|
47
48
|
rootPath: resolvedRootPath,
|
|
48
49
|
packPath: getPackPath(),
|
|
49
50
|
}, {
|
|
50
|
-
persistentCaching: (
|
|
51
|
+
persistentCaching: (_g = bundleOptions.config.persistentCaching) !== null && _g !== void 0 ? _g : false,
|
|
51
52
|
});
|
|
52
53
|
const entrypointsSubscription = project.entrypointsSubscribe();
|
|
53
54
|
let currentEntriesHandlingResolve;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/pack",
|
|
3
|
-
"version": "1.4.0-alpha.
|
|
3
|
+
"version": "1.4.0-alpha.2",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"types": "esm/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@hono/node-server": "^1.19.11",
|
|
42
42
|
"@hono/node-ws": "^1.3.0",
|
|
43
43
|
"@swc/helpers": "0.5.15",
|
|
44
|
-
"@utoo/pack-shared": "1.4.0-alpha.
|
|
44
|
+
"@utoo/pack-shared": "1.4.0-alpha.2",
|
|
45
45
|
"domparser-rs": "^0.0.7",
|
|
46
46
|
"find-up": "4.1.0",
|
|
47
47
|
"get-port": "5.1.1",
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
},
|
|
93
93
|
"repository": "git@github.com:utooland/utoo.git",
|
|
94
94
|
"optionalDependencies": {
|
|
95
|
-
"@utoo/pack-darwin-arm64": "1.4.0-alpha.
|
|
96
|
-
"@utoo/pack-darwin-x64": "1.4.0-alpha.
|
|
97
|
-
"@utoo/pack-linux-arm64-gnu": "1.4.0-alpha.
|
|
98
|
-
"@utoo/pack-linux-arm64-musl": "1.4.0-alpha.
|
|
99
|
-
"@utoo/pack-linux-x64-gnu": "1.4.0-alpha.
|
|
100
|
-
"@utoo/pack-linux-x64-musl": "1.4.0-alpha.
|
|
101
|
-
"@utoo/pack-win32-x64-msvc": "1.4.0-alpha.
|
|
95
|
+
"@utoo/pack-darwin-arm64": "1.4.0-alpha.2",
|
|
96
|
+
"@utoo/pack-darwin-x64": "1.4.0-alpha.2",
|
|
97
|
+
"@utoo/pack-linux-arm64-gnu": "1.4.0-alpha.2",
|
|
98
|
+
"@utoo/pack-linux-arm64-musl": "1.4.0-alpha.2",
|
|
99
|
+
"@utoo/pack-linux-x64-gnu": "1.4.0-alpha.2",
|
|
100
|
+
"@utoo/pack-linux-x64-musl": "1.4.0-alpha.2",
|
|
101
|
+
"@utoo/pack-win32-x64-msvc": "1.4.0-alpha.2"
|
|
102
102
|
}
|
|
103
103
|
}
|