@utoo/pack 1.2.13-alpha.0 → 1.2.13

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
@@ -9,6 +9,22 @@ export declare class ExternalObject<T> {
9
9
  [K: symbol]: T
10
10
  }
11
11
  }
12
+ /** Arguments for `NapiTurbopackCallbacks::throw_turbopack_internal_error`. */
13
+ export interface TurbopackInternalErrorOpts {
14
+ message: string
15
+ anonymizedLocation?: string
16
+ }
17
+ export interface NapiTurbopackCallbacksJsObject {
18
+ /**
19
+ * Called when we've encountered a bug in Turbopack and not in the user's code. Constructs and
20
+ * throws a `TurbopackInternalError` type. Logs to anonymized telemetry.
21
+ *
22
+ * As a result of the use of `ErrorStrategy::CalleeHandled`, the first argument is an error if
23
+ * there's a runtime conversion error. This should never happen, but if it does, the function
24
+ * can throw it instead.
25
+ */
26
+ throwTurbopackInternalError: (conversionError: Error | null, opts: TurbopackInternalErrorOpts) => never
27
+ }
12
28
  export declare function registerWorkerScheduler(creator: (arg: NapiWorkerCreation) => any, terminator: (arg: NapiWorkerTermination) => any): void
13
29
  export declare function workerCreated(workerId: number): void
14
30
  export interface NapiWorkerCreation {
@@ -28,22 +44,6 @@ export interface NapiTaskMessage {
28
44
  }
29
45
  export declare function recvTaskMessageInWorker(workerId: number): Promise<NapiTaskMessage>
30
46
  export declare function sendTaskMessage(message: NapiTaskMessage): Promise<void>
31
- /** Arguments for `NapiTurbopackCallbacks::throw_turbopack_internal_error`. */
32
- export interface TurbopackInternalErrorOpts {
33
- message: string
34
- anonymizedLocation?: string
35
- }
36
- export interface NapiTurbopackCallbacksJsObject {
37
- /**
38
- * Called when we've encountered a bug in Turbopack and not in the user's code. Constructs and
39
- * throws a `TurbopackInternalError` type. Logs to anonymized telemetry.
40
- *
41
- * As a result of the use of `ErrorStrategy::CalleeHandled`, the first argument is an error if
42
- * there's a runtime conversion error. This should never happen, but if it does, the function
43
- * can throw it instead.
44
- */
45
- throwTurbopackInternalError: (conversionError: Error | null, opts: TurbopackInternalErrorOpts) => never
46
- }
47
47
  export interface NapiEndpointConfig {
48
48
 
49
49
  }
@@ -214,6 +214,23 @@ export declare function projectTraceSource(project: { __napiType: "Project" }, f
214
214
  export declare function projectGetSourceForAsset(project: { __napiType: "Project" }, filePath: string): Promise<string | null>
215
215
  export declare function projectGetSourceMap(project: { __napiType: "Project" }, filePath: RcStr): Promise<string | null>
216
216
  export declare function projectGetSourceMapSync(project: { __napiType: "Project" }, filePath: RcStr): string | null
217
+ /**
218
+ * A version of [`NapiTurbopackCallbacks`] that can accepted as an argument to a napi function.
219
+ *
220
+ * This can be converted into a [`NapiTurbopackCallbacks`] with
221
+ * [`NapiTurbopackCallbacks::from_js`].
222
+ */
223
+ export interface NapiTurbopackCallbacksJsObject {
224
+ /**
225
+ * Called when we've encountered a bug in Turbopack and not in the user's code. Constructs and
226
+ * throws a `TurbopackInternalError` type. Logs to anonymized telemetry.
227
+ *
228
+ * As a result of the use of `ErrorStrategy::CalleeHandled`, the first argument is an error if
229
+ * there's a runtime conversion error. This should never happen, but if it does, the function
230
+ * can throw it instead.
231
+ */
232
+ throwTurbopackInternalError: (conversionError: Error | null, opts: TurbopackInternalErrorOpts) => never
233
+ }
217
234
  export declare function rootTaskDispose(rootTask: { __napiType: "RootTask" }): void
218
235
  export interface NapiIssue {
219
236
  severity: string
@@ -0,0 +1,16 @@
1
+ import type { UserConfig } from "./config/types";
2
+ /**
3
+ * Type-safe config helper for utoopack.config.mjs / utoopack.config.js.
4
+ * Provides type inference and editor support, similar to Vite/Rollup defineConfig.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * // utoopack.config.mjs
9
+ * import { defineConfig } from '@utoo/pack';
10
+ * export default defineConfig({
11
+ * entry: [{ import: './src/index.ts', html: { template: './index.html' } }],
12
+ * output: { path: './dist', clean: true },
13
+ * });
14
+ * ```
15
+ */
16
+ export declare function defineConfig(config: UserConfig): UserConfig;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineConfig = defineConfig;
4
+ /**
5
+ * Type-safe config helper for utoopack.config.mjs / utoopack.config.js.
6
+ * Provides type inference and editor support, similar to Vite/Rollup defineConfig.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * // utoopack.config.mjs
11
+ * import { defineConfig } from '@utoo/pack';
12
+ * export default defineConfig({
13
+ * entry: [{ import: './src/index.ts', html: { template: './index.html' } }],
14
+ * output: { path: './dist', clean: true },
15
+ * });
16
+ * ```
17
+ */
18
+ function defineConfig(config) {
19
+ return config;
20
+ }
package/cjs/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { serve } from "./commands/dev";
3
3
  import * as webpackCompat from "./config/webpackCompat";
4
4
  export { build };
5
5
  export { serve };
6
+ export { defineConfig } from "./defineConfig";
6
7
  declare const utoopack: {
7
8
  build: typeof build;
8
9
  serve: typeof serve;
package/cjs/index.js CHANGED
@@ -14,11 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.serve = exports.build = void 0;
17
+ exports.defineConfig = exports.serve = exports.build = void 0;
18
18
  const build_1 = require("./commands/build");
19
19
  Object.defineProperty(exports, "build", { enumerable: true, get: function () { return build_1.build; } });
20
20
  const dev_1 = require("./commands/dev");
21
21
  Object.defineProperty(exports, "serve", { enumerable: true, get: function () { return dev_1.serve; } });
22
+ var defineConfig_1 = require("./defineConfig");
23
+ Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return defineConfig_1.defineConfig; } });
22
24
  const utoopack = { build: build_1.build, serve: dev_1.serve };
23
25
  exports.default = utoopack;
24
26
  __exportStar(require("./config/types"), exports);
package/esm/binding.d.ts CHANGED
@@ -9,6 +9,22 @@ export declare class ExternalObject<T> {
9
9
  [K: symbol]: T
10
10
  }
11
11
  }
12
+ /** Arguments for `NapiTurbopackCallbacks::throw_turbopack_internal_error`. */
13
+ export interface TurbopackInternalErrorOpts {
14
+ message: string
15
+ anonymizedLocation?: string
16
+ }
17
+ export interface NapiTurbopackCallbacksJsObject {
18
+ /**
19
+ * Called when we've encountered a bug in Turbopack and not in the user's code. Constructs and
20
+ * throws a `TurbopackInternalError` type. Logs to anonymized telemetry.
21
+ *
22
+ * As a result of the use of `ErrorStrategy::CalleeHandled`, the first argument is an error if
23
+ * there's a runtime conversion error. This should never happen, but if it does, the function
24
+ * can throw it instead.
25
+ */
26
+ throwTurbopackInternalError: (conversionError: Error | null, opts: TurbopackInternalErrorOpts) => never
27
+ }
12
28
  export declare function registerWorkerScheduler(creator: (arg: NapiWorkerCreation) => any, terminator: (arg: NapiWorkerTermination) => any): void
13
29
  export declare function workerCreated(workerId: number): void
14
30
  export interface NapiWorkerCreation {
@@ -28,22 +44,6 @@ export interface NapiTaskMessage {
28
44
  }
29
45
  export declare function recvTaskMessageInWorker(workerId: number): Promise<NapiTaskMessage>
30
46
  export declare function sendTaskMessage(message: NapiTaskMessage): Promise<void>
31
- /** Arguments for `NapiTurbopackCallbacks::throw_turbopack_internal_error`. */
32
- export interface TurbopackInternalErrorOpts {
33
- message: string
34
- anonymizedLocation?: string
35
- }
36
- export interface NapiTurbopackCallbacksJsObject {
37
- /**
38
- * Called when we've encountered a bug in Turbopack and not in the user's code. Constructs and
39
- * throws a `TurbopackInternalError` type. Logs to anonymized telemetry.
40
- *
41
- * As a result of the use of `ErrorStrategy::CalleeHandled`, the first argument is an error if
42
- * there's a runtime conversion error. This should never happen, but if it does, the function
43
- * can throw it instead.
44
- */
45
- throwTurbopackInternalError: (conversionError: Error | null, opts: TurbopackInternalErrorOpts) => never
46
- }
47
47
  export interface NapiEndpointConfig {
48
48
 
49
49
  }
@@ -214,6 +214,23 @@ export declare function projectTraceSource(project: { __napiType: "Project" }, f
214
214
  export declare function projectGetSourceForAsset(project: { __napiType: "Project" }, filePath: string): Promise<string | null>
215
215
  export declare function projectGetSourceMap(project: { __napiType: "Project" }, filePath: RcStr): Promise<string | null>
216
216
  export declare function projectGetSourceMapSync(project: { __napiType: "Project" }, filePath: RcStr): string | null
217
+ /**
218
+ * A version of [`NapiTurbopackCallbacks`] that can accepted as an argument to a napi function.
219
+ *
220
+ * This can be converted into a [`NapiTurbopackCallbacks`] with
221
+ * [`NapiTurbopackCallbacks::from_js`].
222
+ */
223
+ export interface NapiTurbopackCallbacksJsObject {
224
+ /**
225
+ * Called when we've encountered a bug in Turbopack and not in the user's code. Constructs and
226
+ * throws a `TurbopackInternalError` type. Logs to anonymized telemetry.
227
+ *
228
+ * As a result of the use of `ErrorStrategy::CalleeHandled`, the first argument is an error if
229
+ * there's a runtime conversion error. This should never happen, but if it does, the function
230
+ * can throw it instead.
231
+ */
232
+ throwTurbopackInternalError: (conversionError: Error | null, opts: TurbopackInternalErrorOpts) => never
233
+ }
217
234
  export declare function rootTaskDispose(rootTask: { __napiType: "RootTask" }): void
218
235
  export interface NapiIssue {
219
236
  severity: string
@@ -0,0 +1,16 @@
1
+ import type { UserConfig } from "./config/types";
2
+ /**
3
+ * Type-safe config helper for utoopack.config.mjs / utoopack.config.js.
4
+ * Provides type inference and editor support, similar to Vite/Rollup defineConfig.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * // utoopack.config.mjs
9
+ * import { defineConfig } from '@utoo/pack';
10
+ * export default defineConfig({
11
+ * entry: [{ import: './src/index.ts', html: { template: './index.html' } }],
12
+ * output: { path: './dist', clean: true },
13
+ * });
14
+ * ```
15
+ */
16
+ export declare function defineConfig(config: UserConfig): UserConfig;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Type-safe config helper for utoopack.config.mjs / utoopack.config.js.
3
+ * Provides type inference and editor support, similar to Vite/Rollup defineConfig.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * // utoopack.config.mjs
8
+ * import { defineConfig } from '@utoo/pack';
9
+ * export default defineConfig({
10
+ * entry: [{ import: './src/index.ts', html: { template: './index.html' } }],
11
+ * output: { path: './dist', clean: true },
12
+ * });
13
+ * ```
14
+ */
15
+ export function defineConfig(config) {
16
+ return config;
17
+ }
package/esm/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { serve } from "./commands/dev";
3
3
  import * as webpackCompat from "./config/webpackCompat";
4
4
  export { build };
5
5
  export { serve };
6
+ export { defineConfig } from "./defineConfig";
6
7
  declare const utoopack: {
7
8
  build: typeof build;
8
9
  serve: typeof serve;
package/esm/index.js CHANGED
@@ -2,6 +2,7 @@ import { build } from "./commands/build.js";
2
2
  import { serve } from "./commands/dev.js";
3
3
  export { build };
4
4
  export { serve };
5
+ export { defineConfig } from "./defineConfig.js";
5
6
  const utoopack = { build, serve };
6
7
  export default utoopack;
7
8
  export * from "./config/types.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack",
3
- "version": "1.2.13-alpha.0",
3
+ "version": "1.2.13",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "types": "esm/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@babel/code-frame": "7.22.5",
41
41
  "@swc/helpers": "0.5.15",
42
- "@utoo/pack-shared": "1.2.13-alpha.0",
42
+ "@utoo/pack-shared": "1.2.13",
43
43
  "@utoo/style-loader": "^1.0.0",
44
44
  "domparser-rs": "^0.0.7",
45
45
  "find-up": "4.1.0",
@@ -86,12 +86,12 @@
86
86
  },
87
87
  "repository": "git@github.com:utooland/utoo.git",
88
88
  "optionalDependencies": {
89
- "@utoo/pack-darwin-arm64": "1.2.13-alpha.0",
90
- "@utoo/pack-darwin-x64": "1.2.13-alpha.0",
91
- "@utoo/pack-linux-arm64-gnu": "1.2.13-alpha.0",
92
- "@utoo/pack-linux-arm64-musl": "1.2.13-alpha.0",
93
- "@utoo/pack-linux-x64-gnu": "1.2.13-alpha.0",
94
- "@utoo/pack-linux-x64-musl": "1.2.13-alpha.0",
95
- "@utoo/pack-win32-x64-msvc": "1.2.13-alpha.0"
89
+ "@utoo/pack-darwin-arm64": "1.2.13",
90
+ "@utoo/pack-darwin-x64": "1.2.13",
91
+ "@utoo/pack-linux-arm64-gnu": "1.2.13",
92
+ "@utoo/pack-linux-arm64-musl": "1.2.13",
93
+ "@utoo/pack-linux-x64-gnu": "1.2.13",
94
+ "@utoo/pack-linux-x64-musl": "1.2.13",
95
+ "@utoo/pack-win32-x64-msvc": "1.2.13"
96
96
  }
97
97
  }