@utoo/pack 1.1.12 → 1.1.14-alpha.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
@@ -24,7 +24,7 @@ export interface NapiWorkerTermination {
24
24
  }
25
25
  export interface NapiTaskMessage {
26
26
  taskId: number
27
- data: string
27
+ data: Buffer
28
28
  }
29
29
  export declare function recvTaskMessageInWorker(workerId: number): Promise<NapiTaskMessage>
30
30
  export declare function sendTaskMessage(message: NapiTaskMessage): Promise<void>
@@ -35,7 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.TurbopackInternalError = void 0;
37
37
  exports.projectFactory = projectFactory;
38
- const util_1 = require("util");
39
38
  const binding = __importStar(require("../binding"));
40
39
  const common_1 = require("../utils/common");
41
40
  const loaderWorkerPool_1 = require("./loaderWorkerPool");
@@ -55,41 +54,7 @@ async function withErrorCause(fn) {
55
54
  throw new TurbopackInternalError(nativeError);
56
55
  }
57
56
  }
58
- function ensureLoadersHaveSerializableOptions(turbopackRules) {
59
- for (const [glob, rule] of Object.entries(turbopackRules)) {
60
- if (Array.isArray(rule)) {
61
- checkLoaderItems(rule, glob);
62
- }
63
- else {
64
- checkConfigItem(rule, glob);
65
- }
66
- }
67
- function checkConfigItem(rule, glob) {
68
- if (!rule)
69
- return;
70
- if ("loaders" in rule) {
71
- checkLoaderItems(rule.loaders, glob);
72
- }
73
- else {
74
- for (const key in rule) {
75
- const inner = rule[key];
76
- if (typeof inner === "object" && inner) {
77
- checkConfigItem(inner, glob);
78
- }
79
- }
80
- }
81
- }
82
- function checkLoaderItems(loaderItems, glob) {
83
- for (const loaderItem of loaderItems) {
84
- if (typeof loaderItem !== "string" &&
85
- !(0, util_1.isDeepStrictEqual)(loaderItem, JSON.parse(JSON.stringify(loaderItem)))) {
86
- throw new Error(`loader ${loaderItem.loader} for match "${glob}" does not have serializable options. Ensure that options passed are plain JavaScript objects and values.`);
87
- }
88
- }
89
- }
90
- }
91
57
  async function serializeConfig(config) {
92
- var _a;
93
58
  const configSerializable = { ...config };
94
59
  if (configSerializable.entry) {
95
60
  configSerializable.entry = configSerializable.entry.map((entry) => {
@@ -97,9 +62,6 @@ async function serializeConfig(config) {
97
62
  return rest;
98
63
  });
99
64
  }
100
- if ((_a = configSerializable.module) === null || _a === void 0 ? void 0 : _a.rules) {
101
- ensureLoadersHaveSerializableOptions(configSerializable.module.rules);
102
- }
103
65
  if (configSerializable.optimization) {
104
66
  configSerializable.optimization = { ...configSerializable.optimization };
105
67
  const { modularizeImports } = configSerializable.optimization;
package/esm/binding.d.ts CHANGED
@@ -24,7 +24,7 @@ export interface NapiWorkerTermination {
24
24
  }
25
25
  export interface NapiTaskMessage {
26
26
  taskId: number
27
- data: string
27
+ data: Buffer
28
28
  }
29
29
  export declare function recvTaskMessageInWorker(workerId: number): Promise<NapiTaskMessage>
30
30
  export declare function sendTaskMessage(message: NapiTaskMessage): Promise<void>
@@ -1,4 +1,3 @@
1
- import { isDeepStrictEqual } from "util";
2
1
  import * as binding from "../binding";
3
2
  import { rustifyEnv } from "../utils/common";
4
3
  import { runLoaderWorkerPool } from "./loaderWorkerPool";
@@ -17,41 +16,7 @@ async function withErrorCause(fn) {
17
16
  throw new TurbopackInternalError(nativeError);
18
17
  }
19
18
  }
20
- function ensureLoadersHaveSerializableOptions(turbopackRules) {
21
- for (const [glob, rule] of Object.entries(turbopackRules)) {
22
- if (Array.isArray(rule)) {
23
- checkLoaderItems(rule, glob);
24
- }
25
- else {
26
- checkConfigItem(rule, glob);
27
- }
28
- }
29
- function checkConfigItem(rule, glob) {
30
- if (!rule)
31
- return;
32
- if ("loaders" in rule) {
33
- checkLoaderItems(rule.loaders, glob);
34
- }
35
- else {
36
- for (const key in rule) {
37
- const inner = rule[key];
38
- if (typeof inner === "object" && inner) {
39
- checkConfigItem(inner, glob);
40
- }
41
- }
42
- }
43
- }
44
- function checkLoaderItems(loaderItems, glob) {
45
- for (const loaderItem of loaderItems) {
46
- if (typeof loaderItem !== "string" &&
47
- !isDeepStrictEqual(loaderItem, JSON.parse(JSON.stringify(loaderItem)))) {
48
- throw new Error(`loader ${loaderItem.loader} for match "${glob}" does not have serializable options. Ensure that options passed are plain JavaScript objects and values.`);
49
- }
50
- }
51
- }
52
- }
53
19
  async function serializeConfig(config) {
54
- var _a;
55
20
  const configSerializable = { ...config };
56
21
  if (configSerializable.entry) {
57
22
  configSerializable.entry = configSerializable.entry.map((entry) => {
@@ -59,9 +24,6 @@ async function serializeConfig(config) {
59
24
  return rest;
60
25
  });
61
26
  }
62
- if ((_a = configSerializable.module) === null || _a === void 0 ? void 0 : _a.rules) {
63
- ensureLoadersHaveSerializableOptions(configSerializable.module.rules);
64
- }
65
27
  if (configSerializable.optimization) {
66
28
  configSerializable.optimization = { ...configSerializable.optimization };
67
29
  const { modularizeImports } = configSerializable.optimization;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack",
3
- "version": "1.1.12",
3
+ "version": "1.1.14-alpha.0",
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.1.12",
42
+ "@utoo/pack-shared": "1.1.14-alpha.0",
43
43
  "@utoo/style-loader": "^1.0.0",
44
44
  "domparser-rs": "^0.0.5",
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.1.12",
90
- "@utoo/pack-darwin-x64": "1.1.12",
91
- "@utoo/pack-linux-arm64-gnu": "1.1.12",
92
- "@utoo/pack-linux-arm64-musl": "1.1.12",
93
- "@utoo/pack-linux-x64-gnu": "1.1.12",
94
- "@utoo/pack-linux-x64-musl": "1.1.12",
95
- "@utoo/pack-win32-x64-msvc": "1.1.12"
89
+ "@utoo/pack-darwin-arm64": "1.1.14-alpha.0",
90
+ "@utoo/pack-darwin-x64": "1.1.14-alpha.0",
91
+ "@utoo/pack-linux-arm64-gnu": "1.1.14-alpha.0",
92
+ "@utoo/pack-linux-arm64-musl": "1.1.14-alpha.0",
93
+ "@utoo/pack-linux-x64-gnu": "1.1.14-alpha.0",
94
+ "@utoo/pack-linux-x64-musl": "1.1.14-alpha.0",
95
+ "@utoo/pack-win32-x64-msvc": "1.1.14-alpha.0"
96
96
  }
97
97
  }