@utoo/pack 1.4.0-alpha.9 → 1.4.0

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 CHANGED
@@ -119,6 +119,8 @@ export interface NapiTurboEngineOptions {
119
119
  memoryLimit?: number
120
120
  /** Track dependencies between tasks. If false, any change during build will error. */
121
121
  dependencyTracking?: boolean
122
+ /** Hint that this turbo-tasks instance is for a short-lived one-shot session. */
123
+ isShortSession?: boolean
122
124
  }
123
125
  export declare function projectNew(options: NapiProjectOptions, turboEngineOptions: NapiTurboEngineOptions, napiCallbacks: NapiTurbopackCallbacksJsObject): Promise<{ __napiType: "Project" }>
124
126
  export declare function projectUpdate(project: { __napiType: "Project" }, options: NapiPartialProjectOptions): Promise<void>
@@ -36,29 +36,34 @@ async function buildInternal(bundleOptions, projectPath, rootPath) {
36
36
  }
37
37
  const resolvedProjectPath = projectPath || process.cwd();
38
38
  const resolvedRootPath = rootPath || projectPath || process.cwd();
39
+ const persistentCaching = (_a = bundleOptions.config.persistentCaching) !== null && _a !== void 0 ? _a : false;
39
40
  (0, htmlEntry_1.processHtmlEntry)(bundleOptions.config, resolvedProjectPath);
40
41
  (0, validateEntry_1.validateEntryPaths)(bundleOptions.config, resolvedProjectPath);
41
42
  const createProject = (0, project_1.projectFactory)();
42
43
  const project = await createProject({
43
- processEnv: (_a = bundleOptions.processEnv) !== null && _a !== void 0 ? _a : {},
44
+ processEnv: (_b = bundleOptions.processEnv) !== null && _b !== void 0 ? _b : {},
44
45
  watch: {
45
46
  enable: false,
46
47
  },
47
- dev: (_b = bundleOptions.dev) !== null && _b !== void 0 ? _b : false,
48
+ dev: (_c = bundleOptions.dev) !== null && _c !== void 0 ? _c : false,
48
49
  buildId: bundleOptions.buildId || (0, nanoid_1.nanoid)(),
49
- tracing: (_c = bundleOptions.tracing) !== null && _c !== void 0 ? _c : true,
50
+ tracing: (_d = bundleOptions.tracing) !== null && _d !== void 0 ? _d : true,
50
51
  config: {
51
52
  ...bundleOptions.config,
52
53
  stats: Boolean(process.env.ANALYZE) ||
53
54
  bundleOptions.config.stats ||
54
55
  bundleOptions.config.entry.some((e) => !!e.html),
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"),
56
+ 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"),
56
57
  },
57
58
  projectPath: (0, normalize_path_1.normalizePath)(resolvedProjectPath),
58
59
  rootPath: resolvedRootPath,
59
60
  packPath: (0, common_1.getPackPath)(),
60
61
  }, {
61
- persistentCaching: (_f = bundleOptions.config.persistentCaching) !== null && _f !== void 0 ? _f : false,
62
+ persistentCaching,
63
+ // Build mode is a short-lived, one-shot compilation, so avoid paying
64
+ // dependency graph bookkeeping cost unless the persistent cache needs it.
65
+ dependencyTracking: persistentCaching,
66
+ isShortSession: true,
62
67
  });
63
68
  const entrypoints = await project.writeAllEntrypointsToDisk();
64
69
  (0, pack_shared_1.handleIssues)(entrypoints.issues);
package/esm/binding.d.ts CHANGED
@@ -119,6 +119,8 @@ export interface NapiTurboEngineOptions {
119
119
  memoryLimit?: number
120
120
  /** Track dependencies between tasks. If false, any change during build will error. */
121
121
  dependencyTracking?: boolean
122
+ /** Hint that this turbo-tasks instance is for a short-lived one-shot session. */
123
+ isShortSession?: boolean
122
124
  }
123
125
  export declare function projectNew(options: NapiProjectOptions, turboEngineOptions: NapiTurboEngineOptions, napiCallbacks: NapiTurbopackCallbacksJsObject): Promise<{ __napiType: "Project" }>
124
126
  export declare function projectUpdate(project: { __napiType: "Project" }, options: NapiPartialProjectOptions): Promise<void>
@@ -30,29 +30,34 @@ async function buildInternal(bundleOptions, projectPath, rootPath) {
30
30
  }
31
31
  const resolvedProjectPath = projectPath || process.cwd();
32
32
  const resolvedRootPath = rootPath || projectPath || process.cwd();
33
+ const persistentCaching = (_a = bundleOptions.config.persistentCaching) !== null && _a !== void 0 ? _a : false;
33
34
  processHtmlEntry(bundleOptions.config, resolvedProjectPath);
34
35
  validateEntryPaths(bundleOptions.config, resolvedProjectPath);
35
36
  const createProject = projectFactory();
36
37
  const project = await createProject({
37
- processEnv: (_a = bundleOptions.processEnv) !== null && _a !== void 0 ? _a : {},
38
+ processEnv: (_b = bundleOptions.processEnv) !== null && _b !== void 0 ? _b : {},
38
39
  watch: {
39
40
  enable: false,
40
41
  },
41
- dev: (_b = bundleOptions.dev) !== null && _b !== void 0 ? _b : false,
42
+ dev: (_c = bundleOptions.dev) !== null && _c !== void 0 ? _c : false,
42
43
  buildId: bundleOptions.buildId || nanoid(),
43
- tracing: (_c = bundleOptions.tracing) !== null && _c !== void 0 ? _c : true,
44
+ tracing: (_d = bundleOptions.tracing) !== null && _d !== void 0 ? _d : true,
44
45
  config: {
45
46
  ...bundleOptions.config,
46
47
  stats: Boolean(process.env.ANALYZE) ||
47
48
  bundleOptions.config.stats ||
48
49
  bundleOptions.config.entry.some((e) => !!e.html),
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"),
50
+ 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"),
50
51
  },
51
52
  projectPath: normalizePath(resolvedProjectPath),
52
53
  rootPath: resolvedRootPath,
53
54
  packPath: getPackPath(),
54
55
  }, {
55
- persistentCaching: (_f = bundleOptions.config.persistentCaching) !== null && _f !== void 0 ? _f : false,
56
+ persistentCaching,
57
+ // Build mode is a short-lived, one-shot compilation, so avoid paying
58
+ // dependency graph bookkeeping cost unless the persistent cache needs it.
59
+ dependencyTracking: persistentCaching,
60
+ isShortSession: true,
56
61
  });
57
62
  const entrypoints = await project.writeAllEntrypointsToDisk();
58
63
  handleIssues(entrypoints.issues);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack",
3
- "version": "1.4.0-alpha.9",
3
+ "version": "1.4.0",
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.9",
44
+ "@utoo/pack-shared": "1.4.0",
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.9",
96
- "@utoo/pack-darwin-x64": "1.4.0-alpha.9",
97
- "@utoo/pack-linux-arm64-gnu": "1.4.0-alpha.9",
98
- "@utoo/pack-linux-arm64-musl": "1.4.0-alpha.9",
99
- "@utoo/pack-linux-x64-gnu": "1.4.0-alpha.9",
100
- "@utoo/pack-linux-x64-musl": "1.4.0-alpha.9",
101
- "@utoo/pack-win32-x64-msvc": "1.4.0-alpha.9"
95
+ "@utoo/pack-darwin-arm64": "1.4.0",
96
+ "@utoo/pack-darwin-x64": "1.4.0",
97
+ "@utoo/pack-linux-arm64-gnu": "1.4.0",
98
+ "@utoo/pack-linux-arm64-musl": "1.4.0",
99
+ "@utoo/pack-linux-x64-gnu": "1.4.0",
100
+ "@utoo/pack-linux-x64-musl": "1.4.0",
101
+ "@utoo/pack-win32-x64-msvc": "1.4.0"
102
102
  }
103
103
  }