@unpackjs/core 1.5.3 → 1.6.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/bin/openChrome.applescript +94 -0
- package/compiled/chokidar/index.d.ts +327 -0
- package/compiled/chokidar/index.js +1773 -0
- package/compiled/chokidar/license +21 -0
- package/compiled/chokidar/package.json +1 -0
- package/compiled/commander/index.d.ts +971 -0
- package/compiled/commander/index.js +2190 -0
- package/compiled/commander/license +22 -0
- package/compiled/commander/package.json +1 -0
- package/compiled/css-loader/api.js +85 -0
- package/compiled/css-loader/getUrl.js +26 -0
- package/compiled/css-loader/index.d.ts +1 -0
- package/compiled/css-loader/index.js +8004 -0
- package/compiled/css-loader/license +20 -0
- package/compiled/css-loader/noSourceMaps.js +5 -0
- package/compiled/css-loader/package.json +1 -0
- package/compiled/css-loader/sourceMaps.js +16 -0
- package/compiled/fast-glob/index.d.ts +237 -0
- package/compiled/fast-glob/index.js +5726 -0
- package/compiled/fast-glob/license +21 -0
- package/compiled/fast-glob/package.json +1 -0
- package/compiled/less-loader/index.d.ts +1 -0
- package/compiled/less-loader/index.js +340 -0
- package/compiled/less-loader/license +20 -0
- package/compiled/less-loader/package.json +1 -0
- package/compiled/line-diff/index.d.ts +1 -0
- package/compiled/line-diff/index.js +160 -0
- package/compiled/line-diff/license +21 -0
- package/compiled/line-diff/package.json +1 -0
- package/compiled/log-update/index.d.ts +1 -0
- package/compiled/log-update/index.js +1970 -0
- package/compiled/log-update/package.json +1 -0
- package/compiled/portfinder/index.d.ts +64 -0
- package/compiled/portfinder/index.js +3401 -0
- package/compiled/portfinder/license +22 -0
- package/compiled/portfinder/package.json +1 -0
- package/compiled/postcss-loader/index.d.ts +1 -0
- package/compiled/postcss-loader/index.js +94945 -0
- package/compiled/postcss-loader/license +20 -0
- package/compiled/postcss-loader/package.json +1 -0
- package/compiled/sass-loader/index.d.ts +961 -0
- package/compiled/sass-loader/index.js +5610 -0
- package/compiled/sass-loader/index1.js +65 -0
- package/compiled/sass-loader/license +20 -0
- package/compiled/sass-loader/package.json +1 -0
- package/compiled/sass-loader/sass.node.js +12 -0
- package/compiled/semver/index.d.ts +1 -0
- package/compiled/semver/index.js +1940 -0
- package/compiled/semver/license +15 -0
- package/compiled/semver/package.json +1 -0
- package/compiled/style-loader/index.d.ts +1 -0
- package/compiled/style-loader/index.js +370 -0
- package/compiled/style-loader/license +20 -0
- package/compiled/style-loader/package.json +1 -0
- package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
- package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
- package/compiled/style-loader/runtime/insertBySelector.js +34 -0
- package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
- package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
- package/compiled/style-loader/runtime/isOldIE.js +17 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
- package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
- package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
- package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
- package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
- package/compiled/webpack-bundle-analyzer/index.d.ts +1 -0
- package/compiled/webpack-bundle-analyzer/index.js +13276 -0
- package/compiled/webpack-bundle-analyzer/license +20 -0
- package/compiled/webpack-bundle-analyzer/package.json +1 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
- package/compiled/webpack-merge/index.d.ts +31 -0
- package/compiled/webpack-merge/index.js +1200 -0
- package/compiled/webpack-merge/license +20 -0
- package/compiled/webpack-merge/package.json +1 -0
- package/dist/bundleRequire.cjs +200 -0
- package/dist/bundleRequire.d.ts +5 -0
- package/dist/bundleRequire.d.ts.map +1 -0
- package/dist/bundleRequire.js +173 -0
- package/dist/bundler-config/chunkSplit.cjs +151 -0
- package/dist/bundler-config/chunkSplit.d.ts +6 -0
- package/dist/bundler-config/chunkSplit.d.ts.map +1 -0
- package/dist/bundler-config/chunkSplit.js +127 -0
- package/dist/bundler-config/css.cjs +168 -0
- package/dist/bundler-config/css.d.ts +6 -0
- package/dist/bundler-config/css.d.ts.map +1 -0
- package/dist/bundler-config/css.js +158 -0
- package/dist/bundler-config/experimentCss.cjs +167 -0
- package/dist/bundler-config/experimentCss.d.ts +6 -0
- package/dist/bundler-config/experimentCss.d.ts.map +1 -0
- package/dist/bundler-config/experimentCss.js +157 -0
- package/dist/bundler-config/helper.cjs +81 -0
- package/dist/bundler-config/helper.d.ts +8 -0
- package/dist/bundler-config/helper.d.ts.map +1 -0
- package/dist/bundler-config/helper.js +56 -0
- package/dist/bundler-config/index.cjs +206 -0
- package/dist/bundler-config/index.d.ts +3 -0
- package/dist/bundler-config/index.d.ts.map +1 -0
- package/dist/bundler-config/index.js +190 -0
- package/dist/colors.cjs +60 -0
- package/dist/colors.d.ts +6 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +40 -0
- package/dist/{config/index.cjs → config.cjs} +28 -21
- package/dist/{config/index.d.ts → config.d.ts} +4 -3
- package/dist/config.d.ts.map +1 -0
- package/dist/{config/index.js → config.js} +22 -23
- package/dist/constants.cjs +86 -0
- package/dist/constants.d.ts +25 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +61 -0
- package/dist/createService.cjs +65 -0
- package/dist/createService.d.ts +8 -0
- package/dist/createService.d.ts.map +1 -0
- package/dist/createService.js +41 -0
- package/dist/index.cjs +27 -48
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -51
- package/dist/lightningcss/cache.cjs +36 -0
- package/dist/lightningcss/cache.d.ts +2 -0
- package/dist/lightningcss/cache.d.ts.map +1 -0
- package/dist/lightningcss/cache.js +22 -0
- package/dist/lightningcss/index.cjs +21 -0
- package/dist/lightningcss/index.d.ts +2 -0
- package/dist/lightningcss/index.d.ts.map +1 -0
- package/dist/lightningcss/index.js +10 -0
- package/dist/lightningcss/loader.cjs +56 -0
- package/dist/lightningcss/loader.d.ts +5 -0
- package/dist/lightningcss/loader.d.ts.map +1 -0
- package/dist/lightningcss/loader.js +36 -0
- package/dist/lightningcss/minimizer.cjs +114 -0
- package/dist/lightningcss/minimizer.d.ts +11 -0
- package/dist/lightningcss/minimizer.d.ts.map +1 -0
- package/dist/lightningcss/minimizer.js +90 -0
- package/dist/logger.cjs +103 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +79 -0
- package/dist/openBrowser.cjs +85 -0
- package/dist/openBrowser.d.ts +2 -0
- package/dist/openBrowser.d.ts.map +1 -0
- package/dist/openBrowser.js +61 -0
- package/dist/plugin-progress/rspack.cjs +74 -0
- package/dist/plugin-progress/rspack.d.ts +9 -0
- package/dist/plugin-progress/rspack.d.ts.map +1 -0
- package/dist/plugin-progress/rspack.js +50 -0
- package/dist/plugin-progress/webpack.cjs +84 -0
- package/dist/plugin-progress/webpack.d.ts +9 -0
- package/dist/plugin-progress/webpack.d.ts.map +1 -0
- package/dist/plugin-progress/webpack.js +60 -0
- package/dist/plugin.cjs +33 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +19 -0
- package/dist/progressBar.cjs +70 -0
- package/dist/progressBar.d.ts +14 -0
- package/dist/progressBar.d.ts.map +1 -0
- package/dist/progressBar.js +46 -0
- package/dist/reporter.cjs +133 -0
- package/dist/reporter.d.ts +8 -0
- package/dist/reporter.d.ts.map +1 -0
- package/dist/reporter.js +109 -0
- package/dist/run/build.cjs +77 -0
- package/dist/run/build.d.ts +3 -0
- package/dist/run/build.d.ts.map +1 -0
- package/dist/run/build.js +53 -0
- package/dist/run/dev.cjs +107 -0
- package/dist/run/dev.d.ts +3 -0
- package/dist/run/dev.d.ts.map +1 -0
- package/dist/run/dev.js +83 -0
- package/dist/run/index.cjs +23 -0
- package/dist/run/index.d.ts +3 -0
- package/dist/run/index.d.ts.map +1 -0
- package/dist/run/index.js +11 -0
- package/dist/thread-loader/WorkerError.cjs +41 -0
- package/dist/thread-loader/WorkerError.js +31 -0
- package/dist/thread-loader/WorkerPool.cjs +407 -0
- package/dist/thread-loader/WorkerPool.js +387 -0
- package/dist/thread-loader/index.cjs +100 -0
- package/dist/thread-loader/index.js +85 -0
- package/dist/thread-loader/readBuffer.cjs +55 -0
- package/dist/thread-loader/readBuffer.js +45 -0
- package/dist/thread-loader/serializer.cjs +46 -0
- package/dist/thread-loader/serializer.js +31 -0
- package/dist/thread-loader/utils.cjs +84 -0
- package/dist/thread-loader/utils.js +60 -0
- package/dist/thread-loader/worker.cjs +377 -0
- package/dist/thread-loader/worker.js +382 -0
- package/dist/thread-loader/workerPools.cjs +57 -0
- package/dist/thread-loader/workerPools.js +33 -0
- package/dist/typed-css-modules/index.cjs +21 -0
- package/dist/typed-css-modules/index.d.ts +2 -0
- package/dist/typed-css-modules/index.d.ts.map +1 -0
- package/dist/typed-css-modules/index.js +10 -0
- package/dist/typed-css-modules/loader.cjs +195 -0
- package/dist/typed-css-modules/loader.d.ts +10 -0
- package/dist/typed-css-modules/loader.d.ts.map +1 -0
- package/dist/typed-css-modules/loader.js +170 -0
- package/dist/typed-css-modules/plugin.cjs +96 -0
- package/dist/typed-css-modules/plugin.d.ts +16 -0
- package/dist/typed-css-modules/plugin.d.ts.map +1 -0
- package/dist/typed-css-modules/plugin.js +72 -0
- package/dist/typed-css-modules/utils.cjs +45 -0
- package/dist/typed-css-modules/utils.d.ts +6 -0
- package/dist/typed-css-modules/utils.d.ts.map +1 -0
- package/dist/typed-css-modules/utils.js +31 -0
- package/dist/types/chunkSplit.cjs +15 -0
- package/dist/types/chunkSplit.d.ts +35 -0
- package/dist/types/chunkSplit.d.ts.map +1 -0
- package/dist/types/chunkSplit.js +9 -0
- package/dist/types/config.cjs +15 -0
- package/dist/types/config.d.ts +176 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +9 -0
- package/dist/types/index.cjs +29 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +14 -0
- package/dist/types/lightningcss.cjs +15 -0
- package/dist/types/lightningcss.d.ts +11 -0
- package/dist/types/lightningcss.d.ts.map +1 -0
- package/dist/types/lightningcss.js +9 -0
- package/dist/types/logger.cjs +35 -0
- package/dist/types/logger.d.ts +16 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/logger.js +21 -0
- package/dist/types/plugin.cjs +15 -0
- package/dist/types/plugin.d.ts +18 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +9 -0
- package/dist/utils.cjs +293 -0
- package/dist/utils.d.ts +39 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +242 -0
- package/package.json +95 -6
- package/dist/config/index.d.ts.map +0 -1
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
var require = createRequire(import.meta['url']);
|
|
3
|
+
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __esm = (fn, res) => function __init() {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
};
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
import path from "path";
|
|
12
|
+
import { fileURLToPath } from "url";
|
|
13
|
+
var getFilename, getDirname, __dirname, __filename;
|
|
14
|
+
var init_esm = __esm({
|
|
15
|
+
"../../node_modules/.pnpm/@modern-js+module-tools@2.60.4_typescript@5.5.4/node_modules/@modern-js/module-tools/shims/esm.js"() {
|
|
16
|
+
getFilename = () => fileURLToPath(import.meta.url);
|
|
17
|
+
getDirname = () => path.dirname(getFilename());
|
|
18
|
+
__dirname = /* @__PURE__ */ getDirname();
|
|
19
|
+
__filename = /* @__PURE__ */ getFilename();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
import fs from "node:fs";
|
|
23
|
+
import NativeModule from "node:module";
|
|
24
|
+
import querystring from "node:querystring";
|
|
25
|
+
import loaderRunner from "loader-runner";
|
|
26
|
+
import readBuffer from "./readBuffer.js";
|
|
27
|
+
import { replacer, reviver } from "./serializer.js";
|
|
28
|
+
import { utils } from "./utils.js";
|
|
29
|
+
var require_worker = __commonJS({
|
|
30
|
+
"src/thread-loader/worker.js"(exports) {
|
|
31
|
+
init_esm();
|
|
32
|
+
const asyncQueue = require("neo-async/queue.js");
|
|
33
|
+
const writePipe = fs.createWriteStream(null, { fd: 3 });
|
|
34
|
+
const readPipe = fs.createReadStream(null, { fd: 4 });
|
|
35
|
+
writePipe.on("finish", onTerminateWrite);
|
|
36
|
+
readPipe.on("end", onTerminateRead);
|
|
37
|
+
writePipe.on("close", onTerminateWrite);
|
|
38
|
+
readPipe.on("close", onTerminateRead);
|
|
39
|
+
readPipe.on("error", onError);
|
|
40
|
+
writePipe.on("error", onError);
|
|
41
|
+
const PARALLEL_JOBS = +process.argv[2] || 20;
|
|
42
|
+
let terminated = false;
|
|
43
|
+
let nextQuestionId = 0;
|
|
44
|
+
const callbackMap = /* @__PURE__ */ Object.create(null);
|
|
45
|
+
function onError(error) {
|
|
46
|
+
console.error(error);
|
|
47
|
+
}
|
|
48
|
+
function onTerminateRead() {
|
|
49
|
+
terminateRead();
|
|
50
|
+
}
|
|
51
|
+
function onTerminateWrite() {
|
|
52
|
+
terminateWrite();
|
|
53
|
+
}
|
|
54
|
+
function writePipeWrite(...args) {
|
|
55
|
+
if (!terminated) {
|
|
56
|
+
writePipe.write(...args);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function writePipeCork() {
|
|
60
|
+
if (!terminated) {
|
|
61
|
+
writePipe.cork();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function writePipeUncork() {
|
|
65
|
+
if (!terminated) {
|
|
66
|
+
writePipe.uncork();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function terminateRead() {
|
|
70
|
+
terminated = true;
|
|
71
|
+
readPipe.removeAllListeners();
|
|
72
|
+
}
|
|
73
|
+
function terminateWrite() {
|
|
74
|
+
terminated = true;
|
|
75
|
+
writePipe.removeAllListeners();
|
|
76
|
+
}
|
|
77
|
+
function terminate() {
|
|
78
|
+
terminateRead();
|
|
79
|
+
terminateWrite();
|
|
80
|
+
}
|
|
81
|
+
function toErrorObj(err) {
|
|
82
|
+
return {
|
|
83
|
+
message: err.message,
|
|
84
|
+
details: err.details,
|
|
85
|
+
stack: err.stack,
|
|
86
|
+
hideStack: err.hideStack
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function toNativeError(obj) {
|
|
90
|
+
if (!obj)
|
|
91
|
+
return null;
|
|
92
|
+
const err = new Error(obj.message);
|
|
93
|
+
err.details = obj.details;
|
|
94
|
+
err.missing = obj.missing;
|
|
95
|
+
return err;
|
|
96
|
+
}
|
|
97
|
+
function writeJson(data) {
|
|
98
|
+
writePipeCork();
|
|
99
|
+
process.nextTick(() => {
|
|
100
|
+
writePipeUncork();
|
|
101
|
+
});
|
|
102
|
+
const lengthBuffer = Buffer.alloc(4);
|
|
103
|
+
const messageBuffer = Buffer.from(JSON.stringify(data, replacer), "utf-8");
|
|
104
|
+
lengthBuffer.writeInt32BE(messageBuffer.length, 0);
|
|
105
|
+
writePipeWrite(lengthBuffer);
|
|
106
|
+
writePipeWrite(messageBuffer);
|
|
107
|
+
}
|
|
108
|
+
const queue = asyncQueue(({ id, data }, taskCallback) => {
|
|
109
|
+
try {
|
|
110
|
+
const resolveWithOptions = (context, request, callback, options) => {
|
|
111
|
+
callbackMap[nextQuestionId] = callback;
|
|
112
|
+
writeJson({
|
|
113
|
+
type: "resolve",
|
|
114
|
+
id,
|
|
115
|
+
questionId: nextQuestionId,
|
|
116
|
+
context,
|
|
117
|
+
request,
|
|
118
|
+
options
|
|
119
|
+
});
|
|
120
|
+
nextQuestionId += 1;
|
|
121
|
+
};
|
|
122
|
+
const buildDependencies = [];
|
|
123
|
+
loaderRunner.runLoaders(
|
|
124
|
+
{
|
|
125
|
+
loaders: data.loaders,
|
|
126
|
+
resource: data.resource,
|
|
127
|
+
readResource: fs.readFile.bind(fs),
|
|
128
|
+
context: {
|
|
129
|
+
version: 2,
|
|
130
|
+
fs,
|
|
131
|
+
loadModule: (request, callback) => {
|
|
132
|
+
callbackMap[nextQuestionId] = (error, result) => callback(error, ...result);
|
|
133
|
+
writeJson({
|
|
134
|
+
type: "loadModule",
|
|
135
|
+
id,
|
|
136
|
+
questionId: nextQuestionId,
|
|
137
|
+
request
|
|
138
|
+
});
|
|
139
|
+
nextQuestionId += 1;
|
|
140
|
+
},
|
|
141
|
+
resolve: (context, request, callback) => {
|
|
142
|
+
resolveWithOptions(context, request, callback);
|
|
143
|
+
},
|
|
144
|
+
getResolve: (options) => (context, request, callback) => {
|
|
145
|
+
if (callback) {
|
|
146
|
+
resolveWithOptions(context, request, callback, options);
|
|
147
|
+
} else {
|
|
148
|
+
return new Promise((resolve, reject) => {
|
|
149
|
+
resolveWithOptions(
|
|
150
|
+
context,
|
|
151
|
+
request,
|
|
152
|
+
(err, result) => {
|
|
153
|
+
if (err) {
|
|
154
|
+
reject(err);
|
|
155
|
+
} else {
|
|
156
|
+
resolve(result);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
options
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
// Not an arrow function because it uses this
|
|
165
|
+
getOptions() {
|
|
166
|
+
const loader = this.loaders[this.loaderIndex];
|
|
167
|
+
let { options } = loader;
|
|
168
|
+
if (typeof options === "string") {
|
|
169
|
+
if (options.substr(0, 1) === "{" && options.substr(-1) === "}") {
|
|
170
|
+
try {
|
|
171
|
+
options = JSON.parse(options);
|
|
172
|
+
} catch (e) {
|
|
173
|
+
throw new Error(`Cannot parse string options: ${e.message}`);
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
options = querystring.parse(options, "&", "=", {
|
|
177
|
+
maxKeys: 0
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (options === null || options === void 0) {
|
|
182
|
+
options = {};
|
|
183
|
+
}
|
|
184
|
+
return options;
|
|
185
|
+
},
|
|
186
|
+
emitWarning: (warning) => {
|
|
187
|
+
writeJson({
|
|
188
|
+
type: "emitWarning",
|
|
189
|
+
id,
|
|
190
|
+
data: toErrorObj(warning)
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
emitError: (error) => {
|
|
194
|
+
writeJson({
|
|
195
|
+
type: "emitError",
|
|
196
|
+
id,
|
|
197
|
+
data: toErrorObj(error)
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
exec: (code, filename) => {
|
|
201
|
+
const module2 = new NativeModule(filename, exports);
|
|
202
|
+
module2.paths = NativeModule._nodeModulePaths(exports.context);
|
|
203
|
+
module2.filename = filename;
|
|
204
|
+
module2._compile(code, filename);
|
|
205
|
+
return module2.exports;
|
|
206
|
+
},
|
|
207
|
+
addBuildDependency: (filename) => {
|
|
208
|
+
buildDependencies.push(filename);
|
|
209
|
+
},
|
|
210
|
+
getLogger: (name) => {
|
|
211
|
+
function writeLoggerJson(severity, message) {
|
|
212
|
+
writeJson({
|
|
213
|
+
type: "logger",
|
|
214
|
+
id,
|
|
215
|
+
data: { severity, name, message }
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
writeJson({
|
|
219
|
+
type: "getLogger",
|
|
220
|
+
id,
|
|
221
|
+
data: { name }
|
|
222
|
+
});
|
|
223
|
+
const loggers = [
|
|
224
|
+
"error",
|
|
225
|
+
"warn",
|
|
226
|
+
"info",
|
|
227
|
+
"log",
|
|
228
|
+
"debug",
|
|
229
|
+
"trace",
|
|
230
|
+
"group",
|
|
231
|
+
"groupEnd",
|
|
232
|
+
"groupCollapsed",
|
|
233
|
+
"status",
|
|
234
|
+
"clear",
|
|
235
|
+
"profile",
|
|
236
|
+
"profileEnd"
|
|
237
|
+
];
|
|
238
|
+
const fnMap = {};
|
|
239
|
+
for (const logger of loggers) {
|
|
240
|
+
fnMap[logger] = (...args) => {
|
|
241
|
+
writeLoggerJson(logger, args);
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
return fnMap;
|
|
245
|
+
},
|
|
246
|
+
options: {
|
|
247
|
+
context: data.optionsContext
|
|
248
|
+
},
|
|
249
|
+
webpack: true,
|
|
250
|
+
"thread-loader": true,
|
|
251
|
+
sourceMap: data.sourceMap,
|
|
252
|
+
target: data.target,
|
|
253
|
+
minimize: data.minimize,
|
|
254
|
+
resourceQuery: data.resourceQuery,
|
|
255
|
+
rootContext: data.rootContext,
|
|
256
|
+
_compilation: data._compilation,
|
|
257
|
+
_compiler: data._compiler,
|
|
258
|
+
resourcePath: data.resourcePath,
|
|
259
|
+
utils
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
(err, lrResult) => {
|
|
263
|
+
const { result, cacheable, fileDependencies, contextDependencies, missingDependencies } = lrResult;
|
|
264
|
+
const buffersToSend = [];
|
|
265
|
+
const convertedResult = Array.isArray(result) && result.map((item) => {
|
|
266
|
+
const isBuffer = Buffer.isBuffer(item);
|
|
267
|
+
if (isBuffer) {
|
|
268
|
+
buffersToSend.push(item);
|
|
269
|
+
return {
|
|
270
|
+
buffer: true
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
if (typeof item === "string") {
|
|
274
|
+
const stringBuffer = Buffer.from(item, "utf-8");
|
|
275
|
+
buffersToSend.push(stringBuffer);
|
|
276
|
+
return {
|
|
277
|
+
buffer: true,
|
|
278
|
+
string: true
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
data: item
|
|
283
|
+
};
|
|
284
|
+
});
|
|
285
|
+
writeJson({
|
|
286
|
+
type: "job",
|
|
287
|
+
id,
|
|
288
|
+
error: err && toErrorObj(err),
|
|
289
|
+
result: {
|
|
290
|
+
result: convertedResult,
|
|
291
|
+
cacheable,
|
|
292
|
+
fileDependencies,
|
|
293
|
+
contextDependencies,
|
|
294
|
+
missingDependencies,
|
|
295
|
+
buildDependencies
|
|
296
|
+
},
|
|
297
|
+
data: buffersToSend.map((buffer) => buffer.length)
|
|
298
|
+
});
|
|
299
|
+
buffersToSend.forEach((buffer) => {
|
|
300
|
+
writePipeWrite(buffer);
|
|
301
|
+
});
|
|
302
|
+
setImmediate(taskCallback);
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
} catch (e) {
|
|
306
|
+
writeJson({
|
|
307
|
+
type: "job",
|
|
308
|
+
id,
|
|
309
|
+
error: toErrorObj(e)
|
|
310
|
+
});
|
|
311
|
+
taskCallback();
|
|
312
|
+
}
|
|
313
|
+
}, PARALLEL_JOBS);
|
|
314
|
+
function dispose() {
|
|
315
|
+
terminate();
|
|
316
|
+
queue.kill();
|
|
317
|
+
process.exit(0);
|
|
318
|
+
}
|
|
319
|
+
function onMessage(message) {
|
|
320
|
+
try {
|
|
321
|
+
const { type, id } = message;
|
|
322
|
+
switch (type) {
|
|
323
|
+
case "job": {
|
|
324
|
+
queue.push(message);
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
case "result": {
|
|
328
|
+
const { error, result } = message;
|
|
329
|
+
const callback = callbackMap[id];
|
|
330
|
+
if (callback) {
|
|
331
|
+
const nativeError = toNativeError(error);
|
|
332
|
+
callback(nativeError, result);
|
|
333
|
+
} else {
|
|
334
|
+
console.error(`Worker got unexpected result id ${id}`);
|
|
335
|
+
}
|
|
336
|
+
delete callbackMap[id];
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
case "warmup": {
|
|
340
|
+
const { requires } = message;
|
|
341
|
+
requires.forEach((r) => require(r));
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
default: {
|
|
345
|
+
console.error(`Worker got unexpected job type ${type}`);
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
} catch (e) {
|
|
350
|
+
console.error(`Error in worker ${e}`);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function readNextMessage() {
|
|
354
|
+
readBuffer(readPipe, 4, (lengthReadError, lengthBuffer) => {
|
|
355
|
+
if (lengthReadError) {
|
|
356
|
+
console.error(`Failed to communicate with main process (read length) ${lengthReadError}`);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const length = lengthBuffer.length && lengthBuffer.readInt32BE(0);
|
|
360
|
+
if (length === 0) {
|
|
361
|
+
dispose();
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
readBuffer(readPipe, length, (messageError, messageBuffer) => {
|
|
365
|
+
if (terminated) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (messageError) {
|
|
369
|
+
console.error(`Failed to communicate with main process (read message) ${messageError}`);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const messageString = messageBuffer.toString("utf-8");
|
|
373
|
+
const message = JSON.parse(messageString, reviver);
|
|
374
|
+
onMessage(message);
|
|
375
|
+
setImmediate(() => readNextMessage());
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
readNextMessage();
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
export default require_worker();
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var workerPools_exports = {};
|
|
29
|
+
__export(workerPools_exports, {
|
|
30
|
+
getPool: () => getPool
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(workerPools_exports);
|
|
33
|
+
var import_node_os = __toESM(require("node:os"));
|
|
34
|
+
var import_WorkerPool = __toESM(require("./WorkerPool.cjs"));
|
|
35
|
+
const workerPools = /* @__PURE__ */ Object.create(null);
|
|
36
|
+
function calculateNumberOfWorkers() {
|
|
37
|
+
const cpus = import_node_os.default.cpus() || { length: 1 };
|
|
38
|
+
return Math.max(1, cpus.length - 1);
|
|
39
|
+
}
|
|
40
|
+
function getPool(options) {
|
|
41
|
+
const workerPoolOptions = {
|
|
42
|
+
name: options.name || "",
|
|
43
|
+
numberOfWorkers: options.workers || calculateNumberOfWorkers(),
|
|
44
|
+
workerNodeArgs: options.workerNodeArgs,
|
|
45
|
+
workerParallelJobs: options.workerParallelJobs || 20,
|
|
46
|
+
poolTimeout: options.poolTimeout || 500,
|
|
47
|
+
poolParallelJobs: options.poolParallelJobs || 200,
|
|
48
|
+
poolRespawn: options.poolRespawn || false
|
|
49
|
+
};
|
|
50
|
+
const tpKey = JSON.stringify(workerPoolOptions);
|
|
51
|
+
workerPools[tpKey] = workerPools[tpKey] || new import_WorkerPool.default(workerPoolOptions);
|
|
52
|
+
return workerPools[tpKey];
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
getPool
|
|
57
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
var require = createRequire(import.meta['url']);
|
|
3
|
+
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
var getFilename = () => fileURLToPath(import.meta.url);
|
|
7
|
+
var getDirname = () => path.dirname(getFilename());
|
|
8
|
+
var __dirname = /* @__PURE__ */ getDirname();
|
|
9
|
+
var __filename = /* @__PURE__ */ getFilename();
|
|
10
|
+
import os from "node:os";
|
|
11
|
+
import WorkerPool from "./WorkerPool.js";
|
|
12
|
+
const workerPools = /* @__PURE__ */ Object.create(null);
|
|
13
|
+
function calculateNumberOfWorkers() {
|
|
14
|
+
const cpus = os.cpus() || { length: 1 };
|
|
15
|
+
return Math.max(1, cpus.length - 1);
|
|
16
|
+
}
|
|
17
|
+
function getPool(options) {
|
|
18
|
+
const workerPoolOptions = {
|
|
19
|
+
name: options.name || "",
|
|
20
|
+
numberOfWorkers: options.workers || calculateNumberOfWorkers(),
|
|
21
|
+
workerNodeArgs: options.workerNodeArgs,
|
|
22
|
+
workerParallelJobs: options.workerParallelJobs || 20,
|
|
23
|
+
poolTimeout: options.poolTimeout || 500,
|
|
24
|
+
poolParallelJobs: options.poolParallelJobs || 200,
|
|
25
|
+
poolRespawn: options.poolRespawn || false
|
|
26
|
+
};
|
|
27
|
+
const tpKey = JSON.stringify(workerPoolOptions);
|
|
28
|
+
workerPools[tpKey] = workerPools[tpKey] || new WorkerPool(workerPoolOptions);
|
|
29
|
+
return workerPools[tpKey];
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
getPool
|
|
33
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var typed_css_modules_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(typed_css_modules_exports);
|
|
17
|
+
__reExport(typed_css_modules_exports, require("./plugin.cjs"), module.exports);
|
|
18
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
19
|
+
0 && (module.exports = {
|
|
20
|
+
...require("./plugin.cjs")
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typed-css-modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
var require = createRequire(import.meta['url']);
|
|
3
|
+
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
var getFilename = () => fileURLToPath(import.meta.url);
|
|
7
|
+
var getDirname = () => path.dirname(getFilename());
|
|
8
|
+
var __dirname = /* @__PURE__ */ getDirname();
|
|
9
|
+
var __filename = /* @__PURE__ */ getFilename();
|
|
10
|
+
export * from "./plugin.js";
|