@utoo/web 0.0.1 → 1.0.1

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.
Files changed (38) hide show
  1. package/esm/forkedProject.d.ts +24 -0
  2. package/esm/forkedProject.js +40 -0
  3. package/esm/index.d.ts +1 -17
  4. package/esm/index.js +1 -104
  5. package/esm/installServiceWorker.d.ts +1 -0
  6. package/esm/installServiceWorker.js +36 -0
  7. package/esm/internalProject.d.ts +29 -0
  8. package/esm/internalProject.js +184 -0
  9. package/esm/message.d.ts +1 -0
  10. package/esm/message.js +1 -0
  11. package/esm/project.d.ts +31 -0
  12. package/esm/project.js +120 -0
  13. package/esm/serviceWorker.d.ts +1 -0
  14. package/esm/serviceWorker.js +62 -0
  15. package/esm/threadWorker.d.ts +1 -0
  16. package/esm/threadWorker.js +4 -0
  17. package/esm/type.d.ts +53 -8
  18. package/esm/type.js +12 -1
  19. package/esm/utoo/index.d.ts +156 -20
  20. package/esm/utoo/index.js +1079 -242
  21. package/esm/utoo/index_bg.wasm +0 -0
  22. package/esm/webpackLoaders/loaders/lessLoader/index.d.ts +3 -0
  23. package/esm/webpackLoaders/loaders/lessLoader/index.js +103 -0
  24. package/esm/webpackLoaders/loaders/lessLoader/options.json +67 -0
  25. package/esm/webpackLoaders/loaders/lessLoader/utils.d.ts +14 -0
  26. package/esm/webpackLoaders/loaders/lessLoader/utils.js +217 -0
  27. package/esm/webpackLoaders/worker/cjs.d.ts +2 -0
  28. package/esm/webpackLoaders/worker/cjs.js +77 -0
  29. package/esm/webpackLoaders/worker/index.d.ts +2 -0
  30. package/esm/webpackLoaders/worker/index.js +31 -0
  31. package/esm/webpackLoaders/worker/nodePolyFills.d.ts +14 -0
  32. package/esm/webpackLoaders/worker/nodePolyFills.js +24 -0
  33. package/esm/webpackLoaders/worker/type.d.ts +11 -0
  34. package/esm/webpackLoaders/worker/type.js +1 -0
  35. package/esm/webpackLoaders/workerContent.d.ts +2 -0
  36. package/esm/webpackLoaders/workerContent.js +1 -0
  37. package/esm/worker.js +2 -33
  38. package/package.json +29 -8
Binary file
@@ -0,0 +1,3 @@
1
+ export const __esModule: boolean;
2
+ export default lessLoader;
3
+ declare function lessLoader(source: any): Promise<void>;
@@ -0,0 +1,103 @@
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;
@@ -0,0 +1,67 @@
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
+ }
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ const { type } = require("os");
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.errorFactory = errorFactory;
7
+ exports.getLessImplementation = getLessImplementation;
8
+ exports.getLessOptions = getLessOptions;
9
+ exports.isUnsupportedUrl = isUnsupportedUrl;
10
+ exports.normalizeSourceMap = normalizeSourceMap;
11
+ var _path = _interopRequireDefault(require("path"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ /* eslint-disable class-methods-use-this */
14
+ const trailingSlash = /[/\\]$/;
15
+ // This somewhat changed in Less 3.x. Now the file name comes without the
16
+ // automatically added extension whereas the extension is passed in as `options.ext`.
17
+ // So, if the file name matches this regexp, we simply ignore the proposed extension.
18
+ const IS_SPECIAL_MODULE_IMPORT = /^~[^/]+$/;
19
+ // `[drive_letter]:\` + `\\[server]\[share_name]\`
20
+ const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
21
+ // Examples:
22
+ // - ~package
23
+ // - ~package/
24
+ // - ~@org
25
+ // - ~@org/
26
+ // - ~@org/package
27
+ // - ~@org/package/
28
+ const IS_MODULE_IMPORT = /^~([^/]+|[^/]+\/|@[^/]+[/][^/]+|@[^/]+\/?|@[^/]+[/][^/]+\/)$/;
29
+ const MODULE_REQUEST_REGEX = /^[^?]*~/;
30
+ /**
31
+ * Creates a Less plugin that uses webpack's resolving engine that is provided by the loaderContext.
32
+ *
33
+ * @param {LoaderContext} loaderContext
34
+ * @param {object} implementation
35
+ * @returns {LessPlugin}
36
+ */
37
+ function createWebpackLessPlugin(loaderContext, implementation) {
38
+ const lessOptions = loaderContext.getOptions();
39
+ const resolve = loaderContext.getResolve({
40
+ dependencyType: "less",
41
+ conditionNames: ["less", "style", "..."],
42
+ mainFields: ["less", "style", "main", "..."],
43
+ mainFiles: ["index", "..."],
44
+ extensions: [".less", ".css"],
45
+ preferRelative: true
46
+ });
47
+ class WebpackFileManager extends implementation.FileManager {
48
+ supports(filename) {
49
+ if (filename[0] === "/" || IS_NATIVE_WIN32_PATH.test(filename)) {
50
+ return true;
51
+ }
52
+ if (this.isPathAbsolute(filename)) {
53
+ return false;
54
+ }
55
+ return true;
56
+ }
57
+ // Sync resolving is used at least by the `data-uri` function.
58
+ // This file manager doesn't know how to do it, so let's delegate it
59
+ // to the default file manager of Less.
60
+ // We could probably use loaderContext.resolveSync, but it's deprecated,
61
+ // see https://webpack.js.org/api/loaders/#this-resolvesync
62
+ supportsSync() {
63
+ return false;
64
+ }
65
+ async resolveFilename(filename, currentDirectory) {
66
+ // Less is giving us trailing slashes, but the context should have no trailing slash
67
+ const context = currentDirectory.replace(trailingSlash, "");
68
+ let request = filename;
69
+ // A `~` makes the url an module
70
+ if (MODULE_REQUEST_REGEX.test(filename)) {
71
+ request = request.replace(MODULE_REQUEST_REGEX, "");
72
+ }
73
+ if (IS_MODULE_IMPORT.test(filename)) {
74
+ request = request[request.length - 1] === "/" ? request : `${request}/`;
75
+ }
76
+ return this.resolveRequests(context, [...new Set([request, filename])]);
77
+ }
78
+ async resolveRequests(context, possibleRequests) {
79
+ if (possibleRequests.length === 0) {
80
+ return Promise.reject();
81
+ }
82
+ let result;
83
+ try {
84
+ result = await resolve(context, possibleRequests[0]);
85
+ }
86
+ catch (error) {
87
+ const [, ...tailPossibleRequests] = possibleRequests;
88
+ if (tailPossibleRequests.length === 0) {
89
+ throw error;
90
+ }
91
+ result = await this.resolveRequests(context, tailPossibleRequests);
92
+ }
93
+ return result;
94
+ }
95
+ async loadFile(filename, ...args) {
96
+ let result;
97
+ try {
98
+ if (IS_SPECIAL_MODULE_IMPORT.test(filename) || lessOptions.webpackImporter === "only") {
99
+ const error = new Error();
100
+ error.type = "Next";
101
+ throw error;
102
+ }
103
+ result = await super.loadFile(filename, ...args);
104
+ }
105
+ catch (error) {
106
+ if (error.type !== "File" && error.type !== "Next") {
107
+ return Promise.reject(error);
108
+ }
109
+ try {
110
+ result = await this.resolveFilename(filename, ...args);
111
+ }
112
+ catch (webpackResolveError) {
113
+ error.message = `Less resolver error:\n${error.message}\n\n` + `Webpack resolver error details:\n${webpackResolveError.details}\n\n` + `Webpack resolver error missing:\n${webpackResolveError.missing}\n\n`;
114
+ return Promise.reject(error);
115
+ }
116
+ loaderContext.addDependency(result);
117
+ return super.loadFile(result, ...args);
118
+ }
119
+ const absoluteFilename = _path.default.isAbsolute(result.filename) ? result.filename : _path.default.resolve(".", result.filename);
120
+ loaderContext.addDependency(_path.default.normalize(absoluteFilename));
121
+ return result;
122
+ }
123
+ }
124
+ return {
125
+ install(lessInstance, pluginManager) {
126
+ pluginManager.addFileManager(new WebpackFileManager());
127
+ },
128
+ minVersion: [3, 0, 0]
129
+ };
130
+ }
131
+ /**
132
+ * Get the `less` options from the loader context and normalizes its values
133
+ *
134
+ * @param {object} loaderContext
135
+ * @param {object} loaderOptions
136
+ * @param {object} implementation
137
+ * @returns {Object}
138
+ */
139
+ function getLessOptions(loaderContext, loaderOptions, implementation) {
140
+ const options = typeof loaderOptions.lessOptions === "function" ? loaderOptions.lessOptions(loaderContext) || {} : loaderOptions.lessOptions || {};
141
+ const lessOptions = {
142
+ plugins: [],
143
+ relativeUrls: true,
144
+ // We need to set the filename because otherwise our WebpackFileManager will receive an undefined path for the entry
145
+ filename: loaderContext.resourcePath,
146
+ ...options
147
+ };
148
+ const plugins = lessOptions.plugins.slice();
149
+ const shouldUseWebpackImporter = typeof loaderOptions.webpackImporter === "boolean" || loaderOptions.webpackImporter === "only" ? loaderOptions.webpackImporter : true;
150
+ if (shouldUseWebpackImporter) {
151
+ plugins.unshift(createWebpackLessPlugin(loaderContext, implementation));
152
+ }
153
+ plugins.unshift({
154
+ install(lessProcessor, pluginManager) {
155
+ // eslint-disable-next-line no-param-reassign
156
+ pluginManager.webpackLoaderContext = loaderContext;
157
+ lessOptions.pluginManager = pluginManager;
158
+ }
159
+ });
160
+ lessOptions.plugins = plugins;
161
+ return lessOptions;
162
+ }
163
+ function isUnsupportedUrl(url) {
164
+ // Is Windows path
165
+ if (IS_NATIVE_WIN32_PATH.test(url)) {
166
+ return false;
167
+ }
168
+ // Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
169
+ // Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
170
+ return /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url);
171
+ }
172
+ function normalizeSourceMap(map) {
173
+ const newMap = map;
174
+ // map.file is an optional property that provides the output filename.
175
+ // Since we don't know the final filename in the webpack build chain yet, it makes no sense to have it.
176
+ // eslint-disable-next-line no-param-reassign
177
+ delete newMap.file;
178
+ // eslint-disable-next-line no-param-reassign
179
+ newMap.sourceRoot = "";
180
+ // `less` returns POSIX paths, that's why we need to transform them back to native paths.
181
+ // eslint-disable-next-line no-param-reassign
182
+ newMap.sources = newMap.sources.map(source => _path.default.normalize(source));
183
+ return newMap;
184
+ }
185
+ function getLessImplementation(loaderContext, implementation) {
186
+ let resolvedImplementation = implementation;
187
+ if (!implementation) {
188
+ // eslint-disable-next-line import/no-dynamic-require, global-require
189
+ resolvedImplementation = require("less/lib/less-node/index.js").default;
190
+ }
191
+ else if (typeof implementation === "string") {
192
+ // eslint-disable-next-line import/no-dynamic-require, global-require
193
+ resolvedImplementation = require(implementation);
194
+ }
195
+ // eslint-disable-next-line consistent-return
196
+ return resolvedImplementation;
197
+ }
198
+ function getFileExcerptIfPossible(error) {
199
+ if (typeof error.extract === "undefined") {
200
+ return [];
201
+ }
202
+ const excerpt = error.extract.slice(0, 2);
203
+ const column = Math.max(error.column - 1, 0);
204
+ if (typeof excerpt[0] === "undefined") {
205
+ excerpt.shift();
206
+ }
207
+ excerpt.push(`${new Array(column).join(" ")}^`);
208
+ return excerpt;
209
+ }
210
+ function errorFactory(error) {
211
+ const message = ["\n", ...getFileExcerptIfPossible(error), error.message.charAt(0).toUpperCase() + error.message.slice(1), error.filename ? ` Error in ${_path.default.normalize(error.filename)} (line ${error.line}, column ${error.column})` : ""].join("\n");
212
+ const obj = new Error(message, {
213
+ cause: error
214
+ });
215
+ obj.stack = null;
216
+ return obj;
217
+ }
@@ -0,0 +1,2 @@
1
+ import "systemjs/dist/system.js";
2
+ export declare function cjs(entrypoint: string, importMaps: Record<string, string>): Promise<void>;
@@ -0,0 +1,77 @@
1
+ import "systemjs/dist/system.js";
2
+ import nodePolyFills from "./nodePolyFills";
3
+ export async function cjs(entrypoint, importMaps) {
4
+ debugger;
5
+ await Promise.all(Object.entries(importMaps).map(async ([k, v]) => {
6
+ if (v.startsWith("http")) {
7
+ try {
8
+ const response = await fetch(v);
9
+ if (response.ok) {
10
+ importMaps[k] = await response.text();
11
+ }
12
+ else {
13
+ console.error(`Failed to fetch loader '${k}' from ${v}: ${response.status} ${response.statusText}`);
14
+ delete importMaps[k];
15
+ }
16
+ }
17
+ catch (error) {
18
+ console.error(`Error fetching loader '${k}' from ${v}:`, error);
19
+ delete importMaps[k];
20
+ }
21
+ }
22
+ }));
23
+ Object.assign(importMaps, nodePolyFills);
24
+ const require = (id) => {
25
+ let dependency = System.get(id);
26
+ if (dependency) {
27
+ return dependency.default;
28
+ }
29
+ if (id in nodePolyFills) {
30
+ // @ts-ignore
31
+ return nodePolyFills[id];
32
+ }
33
+ const moduleCode = importMaps[id];
34
+ if (!moduleCode) {
35
+ console.error(`Worker: Dependency ${id} not found in import maps.`);
36
+ return {};
37
+ }
38
+ let finalExports = {};
39
+ const module = { exports: finalExports };
40
+ const exports = module.exports;
41
+ try {
42
+ new Function('require', 'exports', 'module', moduleCode)(require, exports, module);
43
+ finalExports = module.exports;
44
+ }
45
+ catch (e) {
46
+ console.error(`Worker: Error executing dependency module ${id}:`, e);
47
+ throw new Error(`Failed to load CJS dependency ${id}: ${e.message}`);
48
+ }
49
+ System.set(id, { default: finalExports });
50
+ return finalExports;
51
+ };
52
+ require.resolve = (request) => request;
53
+ let entryPointCode;
54
+ for (const path in importMaps) {
55
+ const moduleCode = importMaps[path];
56
+ if (path === entrypoint) {
57
+ entryPointCode = moduleCode;
58
+ // FIXME
59
+ entryPointCode = "self.Buffer = require('buffer').Buffer;" + moduleCode;
60
+ break;
61
+ }
62
+ }
63
+ if (entryPointCode) {
64
+ let finalExports = {};
65
+ const module = { exports: finalExports };
66
+ const exports = module.exports;
67
+ try {
68
+ new Function("require", "exports", "module", entryPointCode)(require, exports, module);
69
+ }
70
+ catch (e) {
71
+ console.error(`Worker: Error executing entry point ${entrypoint}:`, e);
72
+ }
73
+ }
74
+ else {
75
+ console.warn("Warning: Entry point not found in import maps. No final execution step taken.");
76
+ }
77
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: null;
2
+ export default _default;
@@ -0,0 +1,31 @@
1
+ import { cjs } from "./cjs";
2
+ import initWasm, { recvMessageInWorker, recvWorkerRequest, sendTaskMessage, notifyWorkerAck } from "../../utoo";
3
+ const binding = {
4
+ recvWorkerRequest,
5
+ recvMessageInWorker,
6
+ notifyWorkerAck,
7
+ sendTaskMessage
8
+ };
9
+ self.process = {
10
+ env: {},
11
+ cwd: () => self.workerData.cwd
12
+ };
13
+ self.onmessage = async (event) => {
14
+ let [module, memory, meta] = event.data;
15
+ await initWasm(module, memory).catch((err) => {
16
+ console.log(err);
17
+ throw err;
18
+ });
19
+ self.workerData = {
20
+ poolId: meta.workerData.poolId,
21
+ workerId: meta.workerData.workerId,
22
+ cwd: "./",
23
+ binding,
24
+ readFile: async (path) => {
25
+ // TODO: if we want that, just connect to @utoo/web internalProject endpoint port with comlink
26
+ throw new Error('readFile in loader not supported on browser ');
27
+ }
28
+ };
29
+ cjs(meta.loaderAssets.entrypoint, meta.loaderAssets.importMaps);
30
+ };
31
+ export default null;
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ assert: any;
3
+ buffer: any;
4
+ constants: any;
5
+ fs: {
6
+ readFile(path: string, options: any, cb: Function): any;
7
+ };
8
+ path: any;
9
+ url: any;
10
+ util: any;
11
+ less: any;
12
+ "less-loader": any;
13
+ };
14
+ export default _default;
@@ -0,0 +1,24 @@
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
+ const less = require("less/lib/less-node/index.js").default;
8
+ const lessLoader = require("../loaders/lessLoader");
9
+ export default {
10
+ assert,
11
+ buffer,
12
+ constants,
13
+ fs: {
14
+ readFile(path, options, cb) {
15
+ // @ts-ignore
16
+ return self.workerData.readFile(path, options).then((data) => cb(null, data), (err) => cb(err));
17
+ },
18
+ },
19
+ path,
20
+ url,
21
+ util,
22
+ less,
23
+ "less-loader": lessLoader
24
+ };
@@ -0,0 +1,11 @@
1
+ export interface LoaderRunnerMeta {
2
+ workerData: {
3
+ poolId: string;
4
+ workerId: number;
5
+ cwd: string;
6
+ };
7
+ loaderAssets: {
8
+ importMaps: Record<string, string>;
9
+ entrypoint: string;
10
+ };
11
+ }
@@ -0,0 +1 @@
1
+ export {};