@utoo/web 1.0.5 → 1.0.6
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/installServiceWorker.d.ts +1 -1
- package/esm/installServiceWorker.js +2 -2
- package/esm/project.js +2 -2
- package/esm/serviceWorker.js +17 -15
- package/esm/type.d.ts +1 -1
- package/esm/utoo/index.js +12 -12
- package/esm/utoo/index_bg.wasm +0 -0
- package/esm/webpackLoaders/loaders/less-loader/index.js +12 -7
- package/esm/webpackLoaders/loaders/less-loader/options.json +3 -1
- package/esm/webpackLoaders/loaders/less-loader/utils.js +34 -14
- package/esm/webpackLoaders/worker/cjs.js +1 -1
- package/esm/webpackLoaders/worker/index.js +5 -5
- package/esm/webpackLoaders/worker/nodePolyFills.js +7 -7
- package/esm/webpackLoaders/workerContent.d.ts +1 -1
- package/esm/webpackLoaders/workerContent.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function installServiceWorker(url: string, scope: string,
|
|
1
|
+
export declare function installServiceWorker(url: string, scope: string, targetDirToCwd?: string): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServiceWorkerHandShake } from "./message";
|
|
2
|
-
export async function installServiceWorker(url, scope,
|
|
2
|
+
export async function installServiceWorker(url, scope, targetDirToCwd) {
|
|
3
3
|
const registration = await navigator.serviceWorker.register(url, {
|
|
4
4
|
scope: "/",
|
|
5
5
|
});
|
|
@@ -8,7 +8,7 @@ export async function installServiceWorker(url, scope, relativeDirToCwd) {
|
|
|
8
8
|
sw.postMessage({
|
|
9
9
|
[ServiceWorkerHandShake]: true,
|
|
10
10
|
scope,
|
|
11
|
-
|
|
11
|
+
targetDirToCwd,
|
|
12
12
|
});
|
|
13
13
|
resolve();
|
|
14
14
|
}
|
package/esm/project.js
CHANGED
|
@@ -55,9 +55,9 @@ export class Project {
|
|
|
55
55
|
}
|
|
56
56
|
async installServiceWorker() {
|
|
57
57
|
if (this.serviceWorkerOptions) {
|
|
58
|
-
const { url, scope,
|
|
58
|
+
const { url, scope, targetDirToCwd } = this.serviceWorkerOptions;
|
|
59
59
|
// Should add "Service-Worker-Allowed": "/" in page root response headers,
|
|
60
|
-
return await installServiceWorker(url, scope,
|
|
60
|
+
return await installServiceWorker(url, scope, targetDirToCwd);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
async mount() {
|
package/esm/serviceWorker.js
CHANGED
|
@@ -6,7 +6,7 @@ let _promise = new Promise((resolve) => {
|
|
|
6
6
|
});
|
|
7
7
|
let _projectEndpoint;
|
|
8
8
|
let _serviceWorkerScope;
|
|
9
|
-
let
|
|
9
|
+
let _targetDirToCwd;
|
|
10
10
|
self.addEventListener("install", (event) => {
|
|
11
11
|
event.waitUntil(self.skipWaiting());
|
|
12
12
|
});
|
|
@@ -16,24 +16,26 @@ self.addEventListener("activate", (event) => {
|
|
|
16
16
|
self.addEventListener("message", (event) => {
|
|
17
17
|
if (event.data && event.data[ServiceWorkerHandShake] === true) {
|
|
18
18
|
_serviceWorkerScope = event.data.scope;
|
|
19
|
-
|
|
19
|
+
_targetDirToCwd = event.data.targetDirToCwd;
|
|
20
20
|
_projectEndpoint = Project.fork(new MessageChannel(), event.source);
|
|
21
21
|
_resolve();
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
self.addEventListener("fetch",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
self.addEventListener("fetch", (event) => {
|
|
25
|
+
event.respondWith((async () => {
|
|
26
|
+
await _promise;
|
|
27
|
+
let { url: url_str, referrer } = event.request;
|
|
28
|
+
let url = new URL(url_str);
|
|
29
|
+
if (url.pathname.startsWith(_serviceWorkerScope) ||
|
|
30
|
+
(referrer && new URL(referrer).pathname.startsWith(_serviceWorkerScope))) {
|
|
31
|
+
const relativePathToCwd = (_targetDirToCwd !== null && _targetDirToCwd !== void 0 ? _targetDirToCwd : ".") +
|
|
32
|
+
url.pathname.replace(_serviceWorkerScope, "");
|
|
33
|
+
return readFileFromProject(relativePathToCwd);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return fetch(event.request);
|
|
37
|
+
}
|
|
38
|
+
})());
|
|
37
39
|
});
|
|
38
40
|
async function readFileFromProject(projectPath) {
|
|
39
41
|
try {
|
package/esm/type.d.ts
CHANGED
package/esm/utoo/index.js
CHANGED
|
@@ -315,8 +315,8 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
315
315
|
export function wasm_thread_entry_point(ptr) {
|
|
316
316
|
wasm.wasm_thread_entry_point(ptr);
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
wasm.__wbindgen_export_6(arg0, arg1
|
|
318
|
+
function __wbg_adapter_10(arg0, arg1) {
|
|
319
|
+
wasm.__wbindgen_export_6(arg0, arg1);
|
|
320
320
|
}
|
|
321
321
|
let stack_pointer = 128;
|
|
322
322
|
function addBorrowedObject(obj) {
|
|
@@ -325,7 +325,7 @@ function addBorrowedObject(obj) {
|
|
|
325
325
|
heap[--stack_pointer] = obj;
|
|
326
326
|
return stack_pointer;
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function __wbg_adapter_15(arg0, arg1, arg2) {
|
|
329
329
|
try {
|
|
330
330
|
wasm.__wbindgen_export_7(arg0, arg1, addBorrowedObject(arg2));
|
|
331
331
|
}
|
|
@@ -333,10 +333,10 @@ function __wbg_adapter_9(arg0, arg1, arg2) {
|
|
|
333
333
|
heap[stack_pointer++] = undefined;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
wasm.__wbindgen_export_8(arg0, arg1);
|
|
336
|
+
function __wbg_adapter_18(arg0, arg1, arg2) {
|
|
337
|
+
wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2));
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function __wbg_adapter_27(arg0, arg1, arg2) {
|
|
340
340
|
wasm.__wbindgen_export_9(arg0, arg1, addHeapObject(arg2));
|
|
341
341
|
}
|
|
342
342
|
function __wbg_adapter_94(arg0, arg1, arg2, arg3) {
|
|
@@ -1627,12 +1627,12 @@ function __wbg_get_imports() {
|
|
|
1627
1627
|
};
|
|
1628
1628
|
imports.wbg.__wbindgen_cast_228b11ff07fcd80f = function (arg0, arg1) {
|
|
1629
1629
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 8687, function: Function { arguments: [], shim_idx: 600, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1630
|
-
const ret = makeMutClosure(arg0, arg1, 8687,
|
|
1630
|
+
const ret = makeMutClosure(arg0, arg1, 8687, __wbg_adapter_10);
|
|
1631
1631
|
return addHeapObject(ret);
|
|
1632
1632
|
};
|
|
1633
1633
|
imports.wbg.__wbindgen_cast_3255823a0b603d96 = function (arg0, arg1) {
|
|
1634
1634
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 8661, function: Function { arguments: [Ref(NamedExternref("MessageEvent"))], shim_idx: 8685, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1635
|
-
const ret = makeMutClosure(arg0, arg1, 8661,
|
|
1635
|
+
const ret = makeMutClosure(arg0, arg1, 8661, __wbg_adapter_15);
|
|
1636
1636
|
return addHeapObject(ret);
|
|
1637
1637
|
};
|
|
1638
1638
|
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
|
|
@@ -1642,12 +1642,12 @@ function __wbg_get_imports() {
|
|
|
1642
1642
|
};
|
|
1643
1643
|
imports.wbg.__wbindgen_cast_4c807b347a3d0cbf = function (arg0, arg1) {
|
|
1644
1644
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 599, function: Function { arguments: [], shim_idx: 600, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1645
|
-
const ret = makeMutClosure(arg0, arg1, 599,
|
|
1645
|
+
const ret = makeMutClosure(arg0, arg1, 599, __wbg_adapter_10);
|
|
1646
1646
|
return addHeapObject(ret);
|
|
1647
1647
|
};
|
|
1648
1648
|
imports.wbg.__wbindgen_cast_535e935a655d72df = function (arg0, arg1) {
|
|
1649
1649
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 8680, function: Function { arguments: [Externref], shim_idx: 8681, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1650
|
-
const ret = makeMutClosure(arg0, arg1, 8680,
|
|
1650
|
+
const ret = makeMutClosure(arg0, arg1, 8680, __wbg_adapter_18);
|
|
1651
1651
|
return addHeapObject(ret);
|
|
1652
1652
|
};
|
|
1653
1653
|
imports.wbg.__wbindgen_cast_76322aab70622876 = function (arg0, arg1) {
|
|
@@ -1676,12 +1676,12 @@ function __wbg_get_imports() {
|
|
|
1676
1676
|
};
|
|
1677
1677
|
imports.wbg.__wbindgen_cast_ded0188a991d8b3c = function (arg0, arg1) {
|
|
1678
1678
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 8680, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 8681, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1679
|
-
const ret = makeMutClosure(arg0, arg1, 8680,
|
|
1679
|
+
const ret = makeMutClosure(arg0, arg1, 8680, __wbg_adapter_18);
|
|
1680
1680
|
return addHeapObject(ret);
|
|
1681
1681
|
};
|
|
1682
1682
|
imports.wbg.__wbindgen_cast_ffa04fbd359d627f = function (arg0, arg1) {
|
|
1683
1683
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 8661, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 8662, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
1684
|
-
const ret = makeClosure(arg0, arg1, 8661,
|
|
1684
|
+
const ret = makeClosure(arg0, arg1, 8661, __wbg_adapter_27);
|
|
1685
1685
|
return addHeapObject(ret);
|
|
1686
1686
|
};
|
|
1687
1687
|
imports.wbg.__wbindgen_link_dd5153a359f2e504 = function (arg0) {
|
package/esm/utoo/index_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
3
|
+
value: true,
|
|
4
4
|
});
|
|
5
5
|
exports.default = void 0;
|
|
6
6
|
var _path = _interopRequireDefault(require("path"));
|
|
7
7
|
var _options = _interopRequireDefault(require("./options.json"));
|
|
8
8
|
var _utils = require("./utils");
|
|
9
|
-
function _interopRequireDefault(e) {
|
|
9
|
+
function _interopRequireDefault(e) {
|
|
10
|
+
return e && e.__esModule ? e : { default: e };
|
|
11
|
+
}
|
|
10
12
|
async function lessLoader(source) {
|
|
11
13
|
const options = this.getOptions(_options.default);
|
|
12
14
|
const callback = this.async();
|
|
@@ -26,12 +28,15 @@ async function lessLoader(source) {
|
|
|
26
28
|
const useSourceMap = typeof options.sourceMap === "boolean" ? options.sourceMap : this.sourceMap;
|
|
27
29
|
if (useSourceMap) {
|
|
28
30
|
lessOptions.sourceMap = {
|
|
29
|
-
outputSourceFiles: true
|
|
31
|
+
outputSourceFiles: true,
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
let data = source;
|
|
33
35
|
if (typeof options.additionalData !== "undefined") {
|
|
34
|
-
data =
|
|
36
|
+
data =
|
|
37
|
+
typeof options.additionalData === "function"
|
|
38
|
+
? `${await options.additionalData(data, this)}`
|
|
39
|
+
: `${options.additionalData}\n${data}`;
|
|
35
40
|
}
|
|
36
41
|
const logger = this.getLogger("less-loader");
|
|
37
42
|
const loaderContext = this;
|
|
@@ -59,7 +64,7 @@ async function lessLoader(source) {
|
|
|
59
64
|
},
|
|
60
65
|
debug(message) {
|
|
61
66
|
logger.debug(message);
|
|
62
|
-
}
|
|
67
|
+
},
|
|
63
68
|
};
|
|
64
69
|
implementation.logger.addListener(loggerListener);
|
|
65
70
|
let result;
|
|
@@ -82,7 +87,7 @@ async function lessLoader(source) {
|
|
|
82
87
|
delete lessOptions.pluginManager;
|
|
83
88
|
}
|
|
84
89
|
const { css, imports } = result;
|
|
85
|
-
imports.forEach(item => {
|
|
90
|
+
imports.forEach((item) => {
|
|
86
91
|
if ((0, _utils.isUnsupportedUrl)(item)) {
|
|
87
92
|
return;
|
|
88
93
|
}
|
|
@@ -100,4 +105,4 @@ async function lessLoader(source) {
|
|
|
100
105
|
}
|
|
101
106
|
callback(null, css, map);
|
|
102
107
|
}
|
|
103
|
-
var _default = exports.default = lessLoader;
|
|
108
|
+
var _default = (exports.default = lessLoader);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const { type } = require("os");
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
4
|
+
value: true,
|
|
5
5
|
});
|
|
6
6
|
exports.errorFactory = errorFactory;
|
|
7
7
|
exports.getLessImplementation = getLessImplementation;
|
|
@@ -9,7 +9,9 @@ exports.getLessOptions = getLessOptions;
|
|
|
9
9
|
exports.isUnsupportedUrl = isUnsupportedUrl;
|
|
10
10
|
exports.normalizeSourceMap = normalizeSourceMap;
|
|
11
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
function _interopRequireDefault(e) {
|
|
12
|
+
function _interopRequireDefault(e) {
|
|
13
|
+
return e && e.__esModule ? e : { default: e };
|
|
14
|
+
}
|
|
13
15
|
/* eslint-disable class-methods-use-this */
|
|
14
16
|
const trailingSlash = /[/\\]$/;
|
|
15
17
|
// This somewhat changed in Less 3.x. Now the file name comes without the
|
|
@@ -42,7 +44,7 @@ function createWebpackLessPlugin(loaderContext, implementation) {
|
|
|
42
44
|
mainFields: ["less", "style", "main", "..."],
|
|
43
45
|
mainFiles: ["index", "..."],
|
|
44
46
|
extensions: [".less", ".css"],
|
|
45
|
-
preferRelative: true
|
|
47
|
+
preferRelative: true,
|
|
46
48
|
});
|
|
47
49
|
class WebpackFileManager extends implementation.FileManager {
|
|
48
50
|
supports(filename) {
|
|
@@ -95,7 +97,8 @@ function createWebpackLessPlugin(loaderContext, implementation) {
|
|
|
95
97
|
async loadFile(filename, ...args) {
|
|
96
98
|
let result;
|
|
97
99
|
try {
|
|
98
|
-
if (IS_SPECIAL_MODULE_IMPORT.test(filename) ||
|
|
100
|
+
if (IS_SPECIAL_MODULE_IMPORT.test(filename) ||
|
|
101
|
+
lessOptions.webpackImporter === "only") {
|
|
99
102
|
const error = new Error();
|
|
100
103
|
error.type = "Next";
|
|
101
104
|
throw error;
|
|
@@ -110,13 +113,18 @@ function createWebpackLessPlugin(loaderContext, implementation) {
|
|
|
110
113
|
result = await this.resolveFilename(filename, ...args);
|
|
111
114
|
}
|
|
112
115
|
catch (webpackResolveError) {
|
|
113
|
-
error.message =
|
|
116
|
+
error.message =
|
|
117
|
+
`Less resolver error:\n${error.message}\n\n` +
|
|
118
|
+
`Webpack resolver error details:\n${webpackResolveError.details}\n\n` +
|
|
119
|
+
`Webpack resolver error missing:\n${webpackResolveError.missing}\n\n`;
|
|
114
120
|
return Promise.reject(error);
|
|
115
121
|
}
|
|
116
122
|
loaderContext.addDependency(result);
|
|
117
123
|
return super.loadFile(result, ...args);
|
|
118
124
|
}
|
|
119
|
-
const absoluteFilename = _path.default.isAbsolute(result.filename)
|
|
125
|
+
const absoluteFilename = _path.default.isAbsolute(result.filename)
|
|
126
|
+
? result.filename
|
|
127
|
+
: _path.default.resolve(".", result.filename);
|
|
120
128
|
loaderContext.addDependency(_path.default.normalize(absoluteFilename));
|
|
121
129
|
return result;
|
|
122
130
|
}
|
|
@@ -125,7 +133,7 @@ function createWebpackLessPlugin(loaderContext, implementation) {
|
|
|
125
133
|
install(lessInstance, pluginManager) {
|
|
126
134
|
pluginManager.addFileManager(new WebpackFileManager());
|
|
127
135
|
},
|
|
128
|
-
minVersion: [3, 0, 0]
|
|
136
|
+
minVersion: [3, 0, 0],
|
|
129
137
|
};
|
|
130
138
|
}
|
|
131
139
|
/**
|
|
@@ -137,16 +145,21 @@ function createWebpackLessPlugin(loaderContext, implementation) {
|
|
|
137
145
|
* @returns {Object}
|
|
138
146
|
*/
|
|
139
147
|
function getLessOptions(loaderContext, loaderOptions, implementation) {
|
|
140
|
-
const options = typeof loaderOptions.lessOptions === "function"
|
|
148
|
+
const options = typeof loaderOptions.lessOptions === "function"
|
|
149
|
+
? loaderOptions.lessOptions(loaderContext) || {}
|
|
150
|
+
: loaderOptions.lessOptions || {};
|
|
141
151
|
const lessOptions = {
|
|
142
152
|
plugins: [],
|
|
143
153
|
relativeUrls: true,
|
|
144
154
|
// We need to set the filename because otherwise our WebpackFileManager will receive an undefined path for the entry
|
|
145
155
|
filename: loaderContext.resourcePath,
|
|
146
|
-
...options
|
|
156
|
+
...options,
|
|
147
157
|
};
|
|
148
158
|
const plugins = lessOptions.plugins.slice();
|
|
149
|
-
const shouldUseWebpackImporter = typeof loaderOptions.webpackImporter === "boolean" ||
|
|
159
|
+
const shouldUseWebpackImporter = typeof loaderOptions.webpackImporter === "boolean" ||
|
|
160
|
+
loaderOptions.webpackImporter === "only"
|
|
161
|
+
? loaderOptions.webpackImporter
|
|
162
|
+
: true;
|
|
150
163
|
if (shouldUseWebpackImporter) {
|
|
151
164
|
plugins.unshift(createWebpackLessPlugin(loaderContext, implementation));
|
|
152
165
|
}
|
|
@@ -155,7 +168,7 @@ function getLessOptions(loaderContext, loaderOptions, implementation) {
|
|
|
155
168
|
// eslint-disable-next-line no-param-reassign
|
|
156
169
|
pluginManager.webpackLoaderContext = loaderContext;
|
|
157
170
|
lessOptions.pluginManager = pluginManager;
|
|
158
|
-
}
|
|
171
|
+
},
|
|
159
172
|
});
|
|
160
173
|
lessOptions.plugins = plugins;
|
|
161
174
|
return lessOptions;
|
|
@@ -179,7 +192,7 @@ function normalizeSourceMap(map) {
|
|
|
179
192
|
newMap.sourceRoot = "";
|
|
180
193
|
// `less` returns POSIX paths, that's why we need to transform them back to native paths.
|
|
181
194
|
// eslint-disable-next-line no-param-reassign
|
|
182
|
-
newMap.sources = newMap.sources.map(source => _path.default.normalize(source));
|
|
195
|
+
newMap.sources = newMap.sources.map((source) => _path.default.normalize(source));
|
|
183
196
|
return newMap;
|
|
184
197
|
}
|
|
185
198
|
function getLessImplementation(loaderContext, implementation) {
|
|
@@ -208,9 +221,16 @@ function getFileExcerptIfPossible(error) {
|
|
|
208
221
|
return excerpt;
|
|
209
222
|
}
|
|
210
223
|
function errorFactory(error) {
|
|
211
|
-
const message = [
|
|
224
|
+
const message = [
|
|
225
|
+
"\n",
|
|
226
|
+
...getFileExcerptIfPossible(error),
|
|
227
|
+
error.message.charAt(0).toUpperCase() + error.message.slice(1),
|
|
228
|
+
error.filename
|
|
229
|
+
? ` Error in ${_path.default.normalize(error.filename)} (line ${error.line}, column ${error.column})`
|
|
230
|
+
: "",
|
|
231
|
+
].join("\n");
|
|
212
232
|
const obj = new Error(message, {
|
|
213
|
-
cause: error
|
|
233
|
+
cause: error,
|
|
214
234
|
});
|
|
215
235
|
obj.stack = null;
|
|
216
236
|
return obj;
|
|
@@ -39,7 +39,7 @@ export async function cjs(entrypoint, importMaps) {
|
|
|
39
39
|
const module = { exports: finalExports };
|
|
40
40
|
const exports = module.exports;
|
|
41
41
|
try {
|
|
42
|
-
new Function(
|
|
42
|
+
new Function("require", "exports", "module", moduleCode)(require, exports, module);
|
|
43
43
|
finalExports = module.exports;
|
|
44
44
|
}
|
|
45
45
|
catch (e) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import initWasm, { notifyWorkerAck, recvMessageInWorker, recvWorkerRequest, sendTaskMessage, } from "../../utoo";
|
|
1
2
|
import { cjs } from "./cjs";
|
|
2
|
-
import initWasm, { recvMessageInWorker, recvWorkerRequest, sendTaskMessage, notifyWorkerAck } from "../../utoo";
|
|
3
3
|
const binding = {
|
|
4
4
|
recvWorkerRequest,
|
|
5
5
|
recvMessageInWorker,
|
|
6
6
|
notifyWorkerAck,
|
|
7
|
-
sendTaskMessage
|
|
7
|
+
sendTaskMessage,
|
|
8
8
|
};
|
|
9
9
|
self.process = {
|
|
10
10
|
env: {},
|
|
11
|
-
cwd: () => self.workerData.cwd
|
|
11
|
+
cwd: () => self.workerData.cwd,
|
|
12
12
|
};
|
|
13
13
|
self.onmessage = async (event) => {
|
|
14
14
|
let [module, memory, meta] = event.data;
|
|
@@ -23,8 +23,8 @@ self.onmessage = async (event) => {
|
|
|
23
23
|
binding,
|
|
24
24
|
readFile: async (path) => {
|
|
25
25
|
// TODO: if we want that, just connect to @utoo/web internalProject endpoint port with comlink
|
|
26
|
-
throw new Error(
|
|
27
|
-
}
|
|
26
|
+
throw new Error("readFile in loader not supported on browser ");
|
|
27
|
+
},
|
|
28
28
|
};
|
|
29
29
|
cjs(meta.loaderAssets.entrypoint, meta.loaderAssets.importMaps);
|
|
30
30
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const assert = require(
|
|
2
|
-
const buffer = require(
|
|
3
|
-
const constants = require(
|
|
4
|
-
const path = require(
|
|
5
|
-
const url = require(
|
|
6
|
-
const util = require(
|
|
1
|
+
const assert = require("assert");
|
|
2
|
+
const buffer = require("buffer");
|
|
3
|
+
const constants = require("constants");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const url = require("url");
|
|
6
|
+
const util = require("util");
|
|
7
7
|
const less = require("less/lib/less-node/index.js").default;
|
|
8
8
|
const lessLoader = require("../loaders/less-loader");
|
|
9
9
|
export default {
|
|
@@ -20,5 +20,5 @@ export default {
|
|
|
20
20
|
url,
|
|
21
21
|
util,
|
|
22
22
|
less,
|
|
23
|
-
"less-loader": lessLoader
|
|
23
|
+
"less-loader": lessLoader,
|
|
24
24
|
};
|