@utoo/web 1.2.0-rc.1 → 1.2.0-rc.3
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/esm/{aa0ad15d2a587c43406f.wasm → 72c61d34e5927ff08d5d.wasm} +0 -0
- package/esm/loaderWorker.js +1 -1
- package/esm/loaderWorker.js.LICENSE.txt +0 -21
- package/esm/utoo/index.js +12 -12
- package/esm/utoo/index_bg.wasm +0 -0
- package/esm/webpackLoaders/worker/cjs.js +4 -1
- package/esm/webpackLoaders/worker/polyfills/fsPolyfill.d.ts +132 -12
- package/esm/webpackLoaders/worker/polyfills/fsPolyfill.js +58 -5
- package/esm/webpackLoaders/worker/polyfills/nodePolyFills.d.ts +0 -2
- package/esm/webpackLoaders/worker/polyfills/nodePolyFills.js +4 -3
- package/package.json +1 -1
- package/esm/webpackLoaders/loaders/less-loader/index.d.ts +0 -3
- package/esm/webpackLoaders/loaders/less-loader/index.js +0 -103
- package/esm/webpackLoaders/loaders/less-loader/options.json +0 -67
- package/esm/webpackLoaders/loaders/less-loader/utils.d.ts +0 -14
- package/esm/webpackLoaders/loaders/less-loader/utils.js +0 -217
- package/esm/webpackLoaders/worker/polyfills/fastGlobPolyfill.d.ts +0 -2
- package/esm/webpackLoaders/worker/polyfills/fastGlobPolyfill.js +0 -48
|
@@ -16,27 +16,6 @@
|
|
|
16
16
|
* @license MIT
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
/*!
|
|
20
|
-
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
23
|
-
* Licensed under the MIT License.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/*!
|
|
27
|
-
* is-number <https://github.com/jonschlinkert/is-number>
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
30
|
-
* Released under the MIT License.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/*!
|
|
34
|
-
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
|
35
|
-
*
|
|
36
|
-
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
37
|
-
* Released under the MIT License.
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
19
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
41
20
|
|
|
42
21
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
package/esm/utoo/index.js
CHANGED
|
@@ -300,6 +300,12 @@ export function wasm_thread_entry_point(ptr) {
|
|
|
300
300
|
function __wbg_adapter_4(arg0, arg1, arg2) {
|
|
301
301
|
wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
|
|
302
302
|
}
|
|
303
|
+
function __wbg_adapter_13(arg0, arg1) {
|
|
304
|
+
wasm.__wbindgen_export_7(arg0, arg1);
|
|
305
|
+
}
|
|
306
|
+
function __wbg_adapter_26(arg0, arg1, arg2) {
|
|
307
|
+
wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2));
|
|
308
|
+
}
|
|
303
309
|
let stack_pointer = 128;
|
|
304
310
|
function addBorrowedObject(obj) {
|
|
305
311
|
if (stack_pointer == 1)
|
|
@@ -307,20 +313,14 @@ function addBorrowedObject(obj) {
|
|
|
307
313
|
heap[--stack_pointer] = obj;
|
|
308
314
|
return stack_pointer;
|
|
309
315
|
}
|
|
310
|
-
function
|
|
316
|
+
function __wbg_adapter_29(arg0, arg1, arg2) {
|
|
311
317
|
try {
|
|
312
|
-
wasm.
|
|
318
|
+
wasm.__wbindgen_export_9(arg0, arg1, addBorrowedObject(arg2));
|
|
313
319
|
}
|
|
314
320
|
finally {
|
|
315
321
|
heap[stack_pointer++] = undefined;
|
|
316
322
|
}
|
|
317
323
|
}
|
|
318
|
-
function __wbg_adapter_20(arg0, arg1) {
|
|
319
|
-
wasm.__wbindgen_export_8(arg0, arg1);
|
|
320
|
-
}
|
|
321
|
-
function __wbg_adapter_25(arg0, arg1, arg2) {
|
|
322
|
-
wasm.__wbindgen_export_9(arg0, arg1, addHeapObject(arg2));
|
|
323
|
-
}
|
|
324
324
|
function __wbg_adapter_94(arg0, arg1, arg2, arg3) {
|
|
325
325
|
wasm.__wbindgen_export_10(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
326
326
|
}
|
|
@@ -1714,7 +1714,7 @@ function __wbg_get_imports() {
|
|
|
1714
1714
|
};
|
|
1715
1715
|
imports.wbg.__wbindgen_cast_1113a938f979d88a = function (arg0, arg1) {
|
|
1716
1716
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 603, function: Function { arguments: [], shim_idx: 604, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1717
|
-
const ret = makeMutClosure(arg0, arg1, 603,
|
|
1717
|
+
const ret = makeMutClosure(arg0, arg1, 603, __wbg_adapter_13);
|
|
1718
1718
|
return addHeapObject(ret);
|
|
1719
1719
|
};
|
|
1720
1720
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
|
|
@@ -1729,7 +1729,7 @@ function __wbg_get_imports() {
|
|
|
1729
1729
|
};
|
|
1730
1730
|
imports.wbg.__wbindgen_cast_59550fe77af0bf03 = function (arg0, arg1) {
|
|
1731
1731
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 8609, function: Function { arguments: [Ref(NamedExternref("MessageEvent"))], shim_idx: 8630, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1732
|
-
const ret = makeMutClosure(arg0, arg1, 8609,
|
|
1732
|
+
const ret = makeMutClosure(arg0, arg1, 8609, __wbg_adapter_29);
|
|
1733
1733
|
return addHeapObject(ret);
|
|
1734
1734
|
};
|
|
1735
1735
|
imports.wbg.__wbindgen_cast_76322aab70622876 = function (arg0, arg1) {
|
|
@@ -1753,7 +1753,7 @@ function __wbg_get_imports() {
|
|
|
1753
1753
|
};
|
|
1754
1754
|
imports.wbg.__wbindgen_cast_8ecade4ce8b126db = function (arg0, arg1) {
|
|
1755
1755
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 8625, function: Function { arguments: [], shim_idx: 604, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1756
|
-
const ret = makeMutClosure(arg0, arg1, 8625,
|
|
1756
|
+
const ret = makeMutClosure(arg0, arg1, 8625, __wbg_adapter_13);
|
|
1757
1757
|
return addHeapObject(ret);
|
|
1758
1758
|
};
|
|
1759
1759
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function (arg0) {
|
|
@@ -1768,7 +1768,7 @@ function __wbg_get_imports() {
|
|
|
1768
1768
|
};
|
|
1769
1769
|
imports.wbg.__wbindgen_cast_cdaa362fcf12456c = function (arg0, arg1) {
|
|
1770
1770
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 8609, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 8610, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
1771
|
-
const ret = makeClosure(arg0, arg1, 8609,
|
|
1771
|
+
const ret = makeClosure(arg0, arg1, 8609, __wbg_adapter_26);
|
|
1772
1772
|
return addHeapObject(ret);
|
|
1773
1773
|
};
|
|
1774
1774
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
|
package/esm/utoo/index_bg.wasm
CHANGED
|
Binary file
|
|
@@ -51,13 +51,16 @@ const executeModule = (moduleCode, moduleId, id, importMaps, entrypoint) => {
|
|
|
51
51
|
if (moduleId === entrypoint) {
|
|
52
52
|
moduleCode = "self.Buffer = require('buffer').Buffer;" + moduleCode;
|
|
53
53
|
}
|
|
54
|
+
if (!moduleId.endsWith(".json")) {
|
|
55
|
+
moduleCode = `// [Debug] Resolved: ${moduleId}\n` + moduleCode;
|
|
56
|
+
}
|
|
54
57
|
try {
|
|
55
58
|
if (moduleId.endsWith(".json")) {
|
|
56
59
|
finalExports = JSON.parse(moduleCode);
|
|
57
60
|
module.exports = finalExports;
|
|
58
61
|
}
|
|
59
62
|
else {
|
|
60
|
-
new Function("require", "exports", "module", "__filename", "__dirname", moduleCode)(moduleRequire, module.exports, module, moduleId, context);
|
|
63
|
+
new Function("require", "exports", "module", "__filename", "__dirname", "process", moduleCode)(moduleRequire, module.exports, module, moduleId, context, nodePolyFills.process);
|
|
61
64
|
finalExports = module.exports;
|
|
62
65
|
}
|
|
63
66
|
}
|
|
@@ -14,18 +14,58 @@ export declare function rmdir(path: string, options: any, cb: Function): void;
|
|
|
14
14
|
export declare function copyFileSync(src: string, dst: string): void;
|
|
15
15
|
export declare function copyFile(src: string, dst: string, cb: Function): void;
|
|
16
16
|
export declare function statSync(p: string): {
|
|
17
|
+
dev: number;
|
|
18
|
+
ino: number;
|
|
19
|
+
mode: number;
|
|
20
|
+
nlink: number;
|
|
21
|
+
uid: number;
|
|
22
|
+
gid: number;
|
|
23
|
+
rdev: number;
|
|
24
|
+
size: number;
|
|
25
|
+
blksize: number;
|
|
26
|
+
blocks: number;
|
|
27
|
+
atimeMs: number;
|
|
28
|
+
mtimeMs: number;
|
|
29
|
+
ctimeMs: number;
|
|
30
|
+
birthtimeMs: number;
|
|
31
|
+
atime: Date;
|
|
32
|
+
mtime: Date;
|
|
33
|
+
ctime: Date;
|
|
34
|
+
birthtime: Date;
|
|
17
35
|
isDirectory: () => any;
|
|
18
36
|
isFile: () => any;
|
|
19
37
|
isSymbolicLink: () => any;
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
isBlockDevice: () => boolean;
|
|
39
|
+
isCharacterDevice: () => boolean;
|
|
40
|
+
isFIFO: () => boolean;
|
|
41
|
+
isSocket: () => boolean;
|
|
22
42
|
};
|
|
23
43
|
export declare function lstatSync(p: string): {
|
|
44
|
+
dev: number;
|
|
45
|
+
ino: number;
|
|
46
|
+
mode: number;
|
|
47
|
+
nlink: number;
|
|
48
|
+
uid: number;
|
|
49
|
+
gid: number;
|
|
50
|
+
rdev: number;
|
|
51
|
+
size: number;
|
|
52
|
+
blksize: number;
|
|
53
|
+
blocks: number;
|
|
54
|
+
atimeMs: number;
|
|
55
|
+
mtimeMs: number;
|
|
56
|
+
ctimeMs: number;
|
|
57
|
+
birthtimeMs: number;
|
|
58
|
+
atime: Date;
|
|
59
|
+
mtime: Date;
|
|
60
|
+
ctime: Date;
|
|
61
|
+
birthtime: Date;
|
|
24
62
|
isDirectory: () => any;
|
|
25
63
|
isFile: () => any;
|
|
26
64
|
isSymbolicLink: () => any;
|
|
27
|
-
|
|
28
|
-
|
|
65
|
+
isBlockDevice: () => boolean;
|
|
66
|
+
isCharacterDevice: () => boolean;
|
|
67
|
+
isFIFO: () => boolean;
|
|
68
|
+
isSocket: () => boolean;
|
|
29
69
|
};
|
|
30
70
|
export declare function stat(path: string, cb: Function): void;
|
|
31
71
|
export declare function lstat(path: string, cb: Function): void;
|
|
@@ -43,18 +83,58 @@ export declare const promises: {
|
|
|
43
83
|
rmdir: (path: string, options?: any) => Promise<void>;
|
|
44
84
|
copyFile: (src: string, dst: string) => Promise<void>;
|
|
45
85
|
stat: (p: string) => Promise<{
|
|
86
|
+
dev: number;
|
|
87
|
+
ino: number;
|
|
88
|
+
mode: number;
|
|
89
|
+
nlink: number;
|
|
90
|
+
uid: number;
|
|
91
|
+
gid: number;
|
|
92
|
+
rdev: number;
|
|
93
|
+
size: number;
|
|
94
|
+
blksize: number;
|
|
95
|
+
blocks: number;
|
|
96
|
+
atimeMs: number;
|
|
97
|
+
mtimeMs: number;
|
|
98
|
+
ctimeMs: number;
|
|
99
|
+
birthtimeMs: number;
|
|
100
|
+
atime: Date;
|
|
101
|
+
mtime: Date;
|
|
102
|
+
ctime: Date;
|
|
103
|
+
birthtime: Date;
|
|
46
104
|
isDirectory: () => any;
|
|
47
105
|
isFile: () => any;
|
|
48
106
|
isSymbolicLink: () => any;
|
|
49
|
-
|
|
50
|
-
|
|
107
|
+
isBlockDevice: () => boolean;
|
|
108
|
+
isCharacterDevice: () => boolean;
|
|
109
|
+
isFIFO: () => boolean;
|
|
110
|
+
isSocket: () => boolean;
|
|
51
111
|
}>;
|
|
52
112
|
lstat: (p: string) => Promise<{
|
|
113
|
+
dev: number;
|
|
114
|
+
ino: number;
|
|
115
|
+
mode: number;
|
|
116
|
+
nlink: number;
|
|
117
|
+
uid: number;
|
|
118
|
+
gid: number;
|
|
119
|
+
rdev: number;
|
|
120
|
+
size: number;
|
|
121
|
+
blksize: number;
|
|
122
|
+
blocks: number;
|
|
123
|
+
atimeMs: number;
|
|
124
|
+
mtimeMs: number;
|
|
125
|
+
ctimeMs: number;
|
|
126
|
+
birthtimeMs: number;
|
|
127
|
+
atime: Date;
|
|
128
|
+
mtime: Date;
|
|
129
|
+
ctime: Date;
|
|
130
|
+
birthtime: Date;
|
|
53
131
|
isDirectory: () => any;
|
|
54
132
|
isFile: () => any;
|
|
55
133
|
isSymbolicLink: () => any;
|
|
56
|
-
|
|
57
|
-
|
|
134
|
+
isBlockDevice: () => boolean;
|
|
135
|
+
isCharacterDevice: () => boolean;
|
|
136
|
+
isFIFO: () => boolean;
|
|
137
|
+
isSocket: () => boolean;
|
|
58
138
|
}>;
|
|
59
139
|
realpath: (p: string) => Promise<string>;
|
|
60
140
|
access: (path: string, mode?: number) => Promise<void>;
|
|
@@ -98,18 +178,58 @@ declare const _default: {
|
|
|
98
178
|
rmdir: (path: string, options?: any) => Promise<void>;
|
|
99
179
|
copyFile: (src: string, dst: string) => Promise<void>;
|
|
100
180
|
stat: (p: string) => Promise<{
|
|
181
|
+
dev: number;
|
|
182
|
+
ino: number;
|
|
183
|
+
mode: number;
|
|
184
|
+
nlink: number;
|
|
185
|
+
uid: number;
|
|
186
|
+
gid: number;
|
|
187
|
+
rdev: number;
|
|
188
|
+
size: number;
|
|
189
|
+
blksize: number;
|
|
190
|
+
blocks: number;
|
|
191
|
+
atimeMs: number;
|
|
192
|
+
mtimeMs: number;
|
|
193
|
+
ctimeMs: number;
|
|
194
|
+
birthtimeMs: number;
|
|
195
|
+
atime: Date;
|
|
196
|
+
mtime: Date;
|
|
197
|
+
ctime: Date;
|
|
198
|
+
birthtime: Date;
|
|
101
199
|
isDirectory: () => any;
|
|
102
200
|
isFile: () => any;
|
|
103
201
|
isSymbolicLink: () => any;
|
|
104
|
-
|
|
105
|
-
|
|
202
|
+
isBlockDevice: () => boolean;
|
|
203
|
+
isCharacterDevice: () => boolean;
|
|
204
|
+
isFIFO: () => boolean;
|
|
205
|
+
isSocket: () => boolean;
|
|
106
206
|
}>;
|
|
107
207
|
lstat: (p: string) => Promise<{
|
|
208
|
+
dev: number;
|
|
209
|
+
ino: number;
|
|
210
|
+
mode: number;
|
|
211
|
+
nlink: number;
|
|
212
|
+
uid: number;
|
|
213
|
+
gid: number;
|
|
214
|
+
rdev: number;
|
|
215
|
+
size: number;
|
|
216
|
+
blksize: number;
|
|
217
|
+
blocks: number;
|
|
218
|
+
atimeMs: number;
|
|
219
|
+
mtimeMs: number;
|
|
220
|
+
ctimeMs: number;
|
|
221
|
+
birthtimeMs: number;
|
|
222
|
+
atime: Date;
|
|
223
|
+
mtime: Date;
|
|
224
|
+
ctime: Date;
|
|
225
|
+
birthtime: Date;
|
|
108
226
|
isDirectory: () => any;
|
|
109
227
|
isFile: () => any;
|
|
110
228
|
isSymbolicLink: () => any;
|
|
111
|
-
|
|
112
|
-
|
|
229
|
+
isBlockDevice: () => boolean;
|
|
230
|
+
isCharacterDevice: () => boolean;
|
|
231
|
+
isFIFO: () => boolean;
|
|
232
|
+
isSocket: () => boolean;
|
|
113
233
|
}>;
|
|
114
234
|
realpath: (p: string) => Promise<string>;
|
|
115
235
|
access: (path: string, mode?: number) => Promise<void>;
|
|
@@ -183,26 +183,79 @@ export function statSync(p) {
|
|
|
183
183
|
const name = path.basename(p);
|
|
184
184
|
// Root check
|
|
185
185
|
if (p === "/" || p === ".") {
|
|
186
|
+
const now = new Date();
|
|
187
|
+
const nowMs = now.getTime();
|
|
186
188
|
return {
|
|
189
|
+
dev: 0,
|
|
190
|
+
ino: 0,
|
|
191
|
+
mode: 16877,
|
|
192
|
+
nlink: 1,
|
|
193
|
+
uid: 0,
|
|
194
|
+
gid: 0,
|
|
195
|
+
rdev: 0,
|
|
196
|
+
size: 0,
|
|
197
|
+
blksize: 4096,
|
|
198
|
+
blocks: 0,
|
|
199
|
+
atimeMs: nowMs,
|
|
200
|
+
mtimeMs: nowMs,
|
|
201
|
+
ctimeMs: nowMs,
|
|
202
|
+
birthtimeMs: nowMs,
|
|
203
|
+
atime: now,
|
|
204
|
+
mtime: now,
|
|
205
|
+
ctime: now,
|
|
206
|
+
birthtime: now,
|
|
187
207
|
isDirectory: () => true,
|
|
188
208
|
isFile: () => false,
|
|
189
209
|
isSymbolicLink: () => false,
|
|
190
|
-
|
|
191
|
-
|
|
210
|
+
isBlockDevice: () => false,
|
|
211
|
+
isCharacterDevice: () => false,
|
|
212
|
+
isFIFO: () => false,
|
|
213
|
+
isSocket: () => false,
|
|
192
214
|
};
|
|
193
215
|
}
|
|
194
216
|
try {
|
|
195
217
|
const entries = readdirSync(parent, { withFileTypes: true });
|
|
196
218
|
const entry = entries.find((e) => e.name === name);
|
|
197
219
|
if (!entry) {
|
|
198
|
-
|
|
220
|
+
const error = new Error(`ENOENT: no such file or directory, stat '${p}'`);
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
error.code = "ENOENT";
|
|
223
|
+
// @ts-ignore
|
|
224
|
+
error.errno = -2;
|
|
225
|
+
// @ts-ignore
|
|
226
|
+
error.syscall = "stat";
|
|
227
|
+
// @ts-ignore
|
|
228
|
+
error.path = p;
|
|
229
|
+
throw error;
|
|
199
230
|
}
|
|
231
|
+
const now = new Date();
|
|
232
|
+
const nowMs = now.getTime();
|
|
200
233
|
return {
|
|
234
|
+
dev: 0,
|
|
235
|
+
ino: 0,
|
|
236
|
+
mode: entry.isDirectory() ? 16877 : 33188,
|
|
237
|
+
nlink: 1,
|
|
238
|
+
uid: 0,
|
|
239
|
+
gid: 0,
|
|
240
|
+
rdev: 0,
|
|
241
|
+
size: 0,
|
|
242
|
+
blksize: 4096,
|
|
243
|
+
blocks: 0,
|
|
244
|
+
atimeMs: nowMs,
|
|
245
|
+
mtimeMs: nowMs,
|
|
246
|
+
ctimeMs: nowMs,
|
|
247
|
+
birthtimeMs: nowMs,
|
|
248
|
+
atime: now,
|
|
249
|
+
mtime: now,
|
|
250
|
+
ctime: now,
|
|
251
|
+
birthtime: now,
|
|
201
252
|
isDirectory: () => entry.isDirectory(),
|
|
202
253
|
isFile: () => entry.isFile(),
|
|
203
254
|
isSymbolicLink: () => entry.isSymbolicLink(),
|
|
204
|
-
|
|
205
|
-
|
|
255
|
+
isBlockDevice: () => false,
|
|
256
|
+
isCharacterDevice: () => false,
|
|
257
|
+
isFIFO: () => false,
|
|
258
|
+
isSocket: () => false,
|
|
206
259
|
};
|
|
207
260
|
}
|
|
208
261
|
catch (e) {
|
|
@@ -22,7 +22,6 @@ declare const _default: {
|
|
|
22
22
|
readonly "node:domain": any;
|
|
23
23
|
readonly events: any;
|
|
24
24
|
readonly "node:events": any;
|
|
25
|
-
"fast-glob": any;
|
|
26
25
|
readonly http: any;
|
|
27
26
|
readonly "node:http": any;
|
|
28
27
|
readonly http2: any;
|
|
@@ -61,7 +60,6 @@ declare const _default: {
|
|
|
61
60
|
readonly "node:zlib": any;
|
|
62
61
|
fs: typeof fs;
|
|
63
62
|
"node:fs": typeof fs;
|
|
64
|
-
"graceful-fs": typeof fs;
|
|
65
63
|
path: any;
|
|
66
64
|
"node:path": any;
|
|
67
65
|
process: any;
|
|
@@ -7,6 +7,10 @@ process.cwd = () => {
|
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
return ((_a = self.workerData) === null || _a === void 0 ? void 0 : _a.cwd) || (originalCwd === null || originalCwd === void 0 ? void 0 : originalCwd()) || "/";
|
|
9
9
|
};
|
|
10
|
+
if (!process.versions)
|
|
11
|
+
process.versions = {};
|
|
12
|
+
if (!process.versions.node)
|
|
13
|
+
process.versions.node = "24.0.0";
|
|
10
14
|
self.process = process;
|
|
11
15
|
self.global = self;
|
|
12
16
|
const path = require("path");
|
|
@@ -17,7 +21,6 @@ path.resolve = (...args) => {
|
|
|
17
21
|
const cwd = ((_a = self.workerData) === null || _a === void 0 ? void 0 : _a.cwd) || "/";
|
|
18
22
|
return originalResolve(cwd, ...args);
|
|
19
23
|
};
|
|
20
|
-
import fastGlob from "./fastGlobPolyfill";
|
|
21
24
|
import * as fs from "./fsPolyfill";
|
|
22
25
|
import * as workerThreads from "./workerThreadsPolyfill";
|
|
23
26
|
const workerThreadsWithLiveWorkerData = {
|
|
@@ -96,7 +99,6 @@ export default {
|
|
|
96
99
|
get "node:events"() {
|
|
97
100
|
return require("events");
|
|
98
101
|
},
|
|
99
|
-
"fast-glob": fastGlob,
|
|
100
102
|
get http() {
|
|
101
103
|
return require("http");
|
|
102
104
|
},
|
|
@@ -207,7 +209,6 @@ export default {
|
|
|
207
209
|
},
|
|
208
210
|
fs,
|
|
209
211
|
"node:fs": fs,
|
|
210
|
-
"graceful-fs": fs,
|
|
211
212
|
path,
|
|
212
213
|
"node:path": path,
|
|
213
214
|
process,
|
package/package.json
CHANGED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
var _path = _interopRequireDefault(require("path"));
|
|
7
|
-
var _options = _interopRequireDefault(require("./options.json"));
|
|
8
|
-
var _utils = require("./utils");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
async function lessLoader(source) {
|
|
11
|
-
const options = this.getOptions(_options.default);
|
|
12
|
-
const callback = this.async();
|
|
13
|
-
let implementation;
|
|
14
|
-
try {
|
|
15
|
-
implementation = (0, _utils.getLessImplementation)(this, options.implementation);
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
callback(error);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (!implementation) {
|
|
22
|
-
callback(new Error(`The Less implementation "${options.implementation}" not found`));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const lessOptions = (0, _utils.getLessOptions)(this, options, implementation);
|
|
26
|
-
const useSourceMap = typeof options.sourceMap === "boolean" ? options.sourceMap : this.sourceMap;
|
|
27
|
-
if (useSourceMap) {
|
|
28
|
-
lessOptions.sourceMap = {
|
|
29
|
-
outputSourceFiles: true
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
let data = source;
|
|
33
|
-
if (typeof options.additionalData !== "undefined") {
|
|
34
|
-
data = typeof options.additionalData === "function" ? `${await options.additionalData(data, this)}` : `${options.additionalData}\n${data}`;
|
|
35
|
-
}
|
|
36
|
-
const logger = this.getLogger("less-loader");
|
|
37
|
-
const loaderContext = this;
|
|
38
|
-
const loggerListener = {
|
|
39
|
-
error(message) {
|
|
40
|
-
// TODO enable by default in the next major release
|
|
41
|
-
if (options.lessLogAsWarnOrErr) {
|
|
42
|
-
loaderContext.emitError(new Error(message));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
logger.error(message);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
warn(message) {
|
|
49
|
-
// TODO enable by default in the next major release
|
|
50
|
-
if (options.lessLogAsWarnOrErr) {
|
|
51
|
-
loaderContext.emitWarning(new Error(message));
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
logger.warn(message);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
info(message) {
|
|
58
|
-
logger.log(message);
|
|
59
|
-
},
|
|
60
|
-
debug(message) {
|
|
61
|
-
logger.debug(message);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
implementation.logger.addListener(loggerListener);
|
|
65
|
-
let result;
|
|
66
|
-
try {
|
|
67
|
-
result = await implementation.render(data, lessOptions);
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
if (error.filename) {
|
|
71
|
-
// `less` returns forward slashes on windows when `webpack` resolver return an absolute windows path in `WebpackFileManager`
|
|
72
|
-
// Ref: https://github.com/webpack-contrib/less-loader/issues/357
|
|
73
|
-
this.addDependency(_path.default.normalize(error.filename));
|
|
74
|
-
}
|
|
75
|
-
callback((0, _utils.errorFactory)(error));
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
finally {
|
|
79
|
-
// Fix memory leaks in `less`
|
|
80
|
-
implementation.logger.removeListener(loggerListener);
|
|
81
|
-
delete lessOptions.pluginManager.webpackLoaderContext;
|
|
82
|
-
delete lessOptions.pluginManager;
|
|
83
|
-
}
|
|
84
|
-
const { css, imports } = result;
|
|
85
|
-
imports.forEach(item => {
|
|
86
|
-
if ((0, _utils.isUnsupportedUrl)(item)) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
// `less` return forward slashes on windows when `webpack` resolver return an absolute windows path in `WebpackFileManager`
|
|
90
|
-
// Ref: https://github.com/webpack-contrib/less-loader/issues/357
|
|
91
|
-
const normalizedItem = _path.default.normalize(item);
|
|
92
|
-
// Custom `importer` can return only `contents` so item will be relative
|
|
93
|
-
if (_path.default.isAbsolute(normalizedItem)) {
|
|
94
|
-
this.addDependency(normalizedItem);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
let map = typeof result.map === "string" ? JSON.parse(result.map) : result.map;
|
|
98
|
-
if (map && useSourceMap) {
|
|
99
|
-
map = (0, _utils.normalizeSourceMap)(map, this.rootContext);
|
|
100
|
-
}
|
|
101
|
-
callback(null, css, map);
|
|
102
|
-
}
|
|
103
|
-
var _default = exports.default = lessLoader;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"title": "Less Loader options",
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"lessOptions": {
|
|
6
|
-
"description": "Options to pass through to `Less`.",
|
|
7
|
-
"link": "https://github.com/webpack-contrib/less-loader#lessoptions",
|
|
8
|
-
"anyOf": [
|
|
9
|
-
{
|
|
10
|
-
"type": "object",
|
|
11
|
-
"additionalProperties": true
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"instanceof": "Function"
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
"additionalData": {
|
|
19
|
-
"description": "Prepends/Appends `Less` code to the actual entry file.",
|
|
20
|
-
"link": "https://github.com/webpack-contrib/less-loader#additionalData",
|
|
21
|
-
"anyOf": [
|
|
22
|
-
{
|
|
23
|
-
"type": "string"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"instanceof": "Function"
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
"sourceMap": {
|
|
31
|
-
"description": "Enables/Disables generation of source maps.",
|
|
32
|
-
"link": "https://github.com/webpack-contrib/less-loader#sourcemap",
|
|
33
|
-
"type": "boolean"
|
|
34
|
-
},
|
|
35
|
-
"webpackImporter": {
|
|
36
|
-
"description": "Enables/Disables default `webpack` importer.",
|
|
37
|
-
"link": "https://github.com/webpack-contrib/less-loader#webpackimporter",
|
|
38
|
-
"anyOf": [
|
|
39
|
-
{
|
|
40
|
-
"type": "boolean"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"type": "string",
|
|
44
|
-
"enum": ["only"]
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
"implementation": {
|
|
49
|
-
"description": "The implementation of the `Less` to be used.",
|
|
50
|
-
"link": "https://github.com/webpack-contrib/less-loader#implementation",
|
|
51
|
-
"anyOf": [
|
|
52
|
-
{
|
|
53
|
-
"type": "string"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"type": "object"
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
"lessLogAsWarnOrErr": {
|
|
61
|
-
"description": "Less warnings and errors will be webpack warnings or errors.",
|
|
62
|
-
"link": "https://github.com/webpack-contrib/less-loader#lesslogaswarnorerr",
|
|
63
|
-
"type": "boolean"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"additionalProperties": false
|
|
67
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const __esModule: boolean;
|
|
2
|
-
export function errorFactory(error: any): Error;
|
|
3
|
-
export function getLessImplementation(loaderContext: any, implementation: any): any;
|
|
4
|
-
/**
|
|
5
|
-
* Get the `less` options from the loader context and normalizes its values
|
|
6
|
-
*
|
|
7
|
-
* @param {object} loaderContext
|
|
8
|
-
* @param {object} loaderOptions
|
|
9
|
-
* @param {object} implementation
|
|
10
|
-
* @returns {Object}
|
|
11
|
-
*/
|
|
12
|
-
export function getLessOptions(loaderContext: object, loaderOptions: object, implementation: object): Object;
|
|
13
|
-
export function isUnsupportedUrl(url: any): boolean;
|
|
14
|
-
export function normalizeSourceMap(map: any): any;
|