@rspack/core 0.0.0-20221102114315 → 0.0.0-20221103045015

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/dist/bundle.js ADDED
@@ -0,0 +1 @@
1
+ self.__rspack_runtime__.__rspack_register__(["main"],{"./a.js":function(_,r,s,e,i){"use strict";_.exports=function(){return"This is a"}}}),self.__rspack_runtime__.__rspack_require__("./a.js");
package/dist/main.js ADDED
@@ -0,0 +1 @@
1
+ self.__rspack_runtime__.__rspack_register__(["main"],{"./fixtures/a.js":function(_,r,s,e,i){"use strict";_.exports=function(){return"This is a"}}}),self.__rspack_runtime__.__rspack_require__("./fixtures/a.js");
@@ -0,0 +1,12 @@
1
+ import { Compiler } from "../compiler";
2
+ import { InfrastructureLogging } from "../config/RspackOptions";
3
+ export declare class NodeEnvironmentPlugin {
4
+ options: {
5
+ infrastructureLogging: InfrastructureLogging;
6
+ };
7
+ constructor(options: {
8
+ infrastructureLogging: InfrastructureLogging;
9
+ });
10
+ apply(compiler: Compiler): void;
11
+ }
12
+ //# sourceMappingURL=NodeEnvironmentPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeEnvironmentPlugin.d.ts","sourceRoot":"","sources":["../../src/node/NodeEnvironmentPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,qBAAa,qBAAqB;IAEzB,OAAO,EAAE;QACf,qBAAqB,EAAE,qBAAqB,CAAC;KAC7C;gBAFM,OAAO,EAAE;QACf,qBAAqB,EAAE,qBAAqB,CAAC;KAC7C;IAIF,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAiBxB"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.NodeEnvironmentPlugin = void 0;
7
+ const createConsoleLogger_1 = __importDefault(require("../logging/createConsoleLogger"));
8
+ const nodeConsole_1 = __importDefault(require("./nodeConsole"));
9
+ const NodeWatchFileSystem_1 = require("./NodeWatchFileSystem");
10
+ class NodeEnvironmentPlugin {
11
+ constructor(options) {
12
+ this.options = options;
13
+ this.options = options;
14
+ }
15
+ apply(compiler) {
16
+ const { infrastructureLogging } = this.options;
17
+ compiler.infrastructureLogger = (0, createConsoleLogger_1.default)({
18
+ level: infrastructureLogging.level || "info",
19
+ debug: infrastructureLogging.debug || false,
20
+ console: infrastructureLogging.console ||
21
+ (0, nodeConsole_1.default)({
22
+ colors: infrastructureLogging.colors,
23
+ appendOnly: infrastructureLogging.appendOnly,
24
+ stream: infrastructureLogging.stream
25
+ })
26
+ });
27
+ compiler.watchFileSystem = new NodeWatchFileSystem_1.NodeWatchFileSystem(compiler.inputFileSystem);
28
+ }
29
+ }
30
+ exports.NodeEnvironmentPlugin = NodeEnvironmentPlugin;
31
+ //# sourceMappingURL=NodeEnvironmentPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeEnvironmentPlugin.js","sourceRoot":"","sources":["../../src/node/NodeEnvironmentPlugin.ts"],"names":[],"mappings":";;;;;;AAEA,yFAAiE;AACjE,gEAAwC;AACxC,+DAA4D;AAE5D,MAAa,qBAAqB;IACjC,YACQ,OAEN;QAFM,YAAO,GAAP,OAAO,CAEb;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IACD,KAAK,CAAC,QAAkB;QACvB,MAAM,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC/C,QAAQ,CAAC,oBAAoB,GAAG,IAAA,6BAAmB,EAAC;YACnD,KAAK,EAAE,qBAAqB,CAAC,KAAK,IAAI,MAAM;YAC5C,KAAK,EAAE,qBAAqB,CAAC,KAAK,IAAI,KAAK;YAC3C,OAAO,EACN,qBAAqB,CAAC,OAAO;gBAC7B,IAAA,qBAAW,EAAC;oBACX,MAAM,EAAE,qBAAqB,CAAC,MAAM;oBACpC,UAAU,EAAE,qBAAqB,CAAC,UAAU;oBAC5C,MAAM,EAAE,qBAAqB,CAAC,MAAM;iBACpC,CAAC;SACH,CAAC,CAAC;QACH,QAAQ,CAAC,eAAe,GAAG,IAAI,yCAAmB,CACjD,QAAQ,CAAC,eAAe,CACxB,CAAC;IACH,CAAC;CACD;AAzBD,sDAyBC"}
@@ -0,0 +1,31 @@
1
+ export declare class NodeWatchFileSystem {
2
+ inputFileSystem: any;
3
+ watcherOptions: any;
4
+ watcher: any;
5
+ constructor(inputFileSystem: any);
6
+ /**
7
+ * @param {Iterable<string>} files watched files
8
+ * @param {Iterable<string>} directories watched directories
9
+ * @param {Iterable<string>} missing watched exitance entries
10
+ * @param {number} startTime timestamp of start time
11
+ * @param {WatchOptions} options options object
12
+ * @param {function(Error=, Map<string, FileSystemInfoEntry>, Map<string, FileSystemInfoEntry>, Set<string>, Set<string>): void} callback aggregated callback
13
+ * @param {function(string, number): void} callbackUndelayed callback when the first change was detected
14
+ * @returns {Watcher} a watcher
15
+ */
16
+ watch(files: any, directories: any, missing: any, startTime: any, options: any, callback: any, callbackUndelayed: any): {
17
+ close: () => void;
18
+ pause: () => void;
19
+ getAggregatedRemovals: any;
20
+ getAggregatedChanges: any;
21
+ getFileTimeInfoEntries: any;
22
+ getContextTimeInfoEntries: any;
23
+ getInfo: () => {
24
+ changes: any;
25
+ removals: any;
26
+ fileTimeInfoEntries: Map<any, any>;
27
+ contextTimeInfoEntries: Map<any, any>;
28
+ };
29
+ };
30
+ }
31
+ //# sourceMappingURL=NodeWatchFileSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeWatchFileSystem.d.ts","sourceRoot":"","sources":["../../src/node/NodeWatchFileSystem.ts"],"names":[],"mappings":"AAQA,qBAAa,mBAAmB;IAC/B,eAAe,EAAE,GAAG,CAAC;IACrB,cAAc,EAAE,GAAG,CAAC;IACpB,OAAO,EAAE,GAAG,CAAC;gBACD,eAAe,KAAA;IAQ3B;;;;;;;;;OASG;IACH,KAAK,CACJ,KAAK,KAAA,EACL,WAAW,KAAA,EACX,OAAO,KAAA,EACP,SAAS,KAAA,EACT,OAAO,KAAA,EACP,QAAQ,KAAA,EACR,iBAAiB,KAAA;;;;;;;;;;;;;;CAqJlB"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ /*
3
+ MIT License http://www.opensource.org/licenses/mit-license.php
4
+ Author Tobias Koppers @sokra
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.NodeWatchFileSystem = void 0;
8
+ const util = require("util");
9
+ const Watchpack = require("watchpack");
10
+ class NodeWatchFileSystem {
11
+ constructor(inputFileSystem) {
12
+ this.inputFileSystem = inputFileSystem;
13
+ this.watcherOptions = {
14
+ aggregateTimeout: 0
15
+ };
16
+ this.watcher = new Watchpack(this.watcherOptions);
17
+ }
18
+ /**
19
+ * @param {Iterable<string>} files watched files
20
+ * @param {Iterable<string>} directories watched directories
21
+ * @param {Iterable<string>} missing watched exitance entries
22
+ * @param {number} startTime timestamp of start time
23
+ * @param {WatchOptions} options options object
24
+ * @param {function(Error=, Map<string, FileSystemInfoEntry>, Map<string, FileSystemInfoEntry>, Set<string>, Set<string>): void} callback aggregated callback
25
+ * @param {function(string, number): void} callbackUndelayed callback when the first change was detected
26
+ * @returns {Watcher} a watcher
27
+ */
28
+ watch(files, directories, missing, startTime, options, callback, callbackUndelayed) {
29
+ if (!files || typeof files[Symbol.iterator] !== "function") {
30
+ throw new Error("Invalid arguments: 'files'");
31
+ }
32
+ if (!directories || typeof directories[Symbol.iterator] !== "function") {
33
+ throw new Error("Invalid arguments: 'directories'");
34
+ }
35
+ if (!missing || typeof missing[Symbol.iterator] !== "function") {
36
+ throw new Error("Invalid arguments: 'missing'");
37
+ }
38
+ if (typeof callback !== "function") {
39
+ throw new Error("Invalid arguments: 'callback'");
40
+ }
41
+ if (typeof startTime !== "number" && startTime) {
42
+ throw new Error("Invalid arguments: 'startTime'");
43
+ }
44
+ if (typeof options !== "object") {
45
+ throw new Error("Invalid arguments: 'options'");
46
+ }
47
+ if (typeof callbackUndelayed !== "function" && callbackUndelayed) {
48
+ throw new Error("Invalid arguments: 'callbackUndelayed'");
49
+ }
50
+ const oldWatcher = this.watcher;
51
+ this.watcher = new Watchpack(options);
52
+ if (callbackUndelayed) {
53
+ this.watcher.once("change", callbackUndelayed);
54
+ }
55
+ const fetchTimeInfo = () => {
56
+ const fileTimeInfoEntries = new Map();
57
+ const contextTimeInfoEntries = new Map();
58
+ if (this.watcher) {
59
+ this.watcher.collectTimeInfoEntries(fileTimeInfoEntries, contextTimeInfoEntries);
60
+ }
61
+ return { fileTimeInfoEntries, contextTimeInfoEntries };
62
+ };
63
+ this.watcher.once("aggregated", (changes, removals) => {
64
+ // pause emitting events (avoids clearing aggregated changes and removals on timeout)
65
+ this.watcher.pause();
66
+ if (this.inputFileSystem && this.inputFileSystem.purge) {
67
+ const fs = this.inputFileSystem;
68
+ for (const item of changes) {
69
+ fs.purge(item);
70
+ }
71
+ for (const item of removals) {
72
+ fs.purge(item);
73
+ }
74
+ }
75
+ const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo();
76
+ callback(null, fileTimeInfoEntries, contextTimeInfoEntries, changes, removals);
77
+ });
78
+ this.watcher.watch({ files, directories, missing, startTime });
79
+ if (oldWatcher) {
80
+ oldWatcher.close();
81
+ }
82
+ return {
83
+ close: () => {
84
+ if (this.watcher) {
85
+ this.watcher.close();
86
+ this.watcher = null;
87
+ }
88
+ },
89
+ pause: () => {
90
+ if (this.watcher) {
91
+ this.watcher.pause();
92
+ }
93
+ },
94
+ getAggregatedRemovals: util.deprecate(() => {
95
+ const items = this.watcher && this.watcher.aggregatedRemovals;
96
+ if (items && this.inputFileSystem && this.inputFileSystem.purge) {
97
+ const fs = this.inputFileSystem;
98
+ for (const item of items) {
99
+ fs.purge(item);
100
+ }
101
+ }
102
+ return items;
103
+ }, "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS"),
104
+ getAggregatedChanges: util.deprecate(() => {
105
+ const items = this.watcher && this.watcher.aggregatedChanges;
106
+ if (items && this.inputFileSystem && this.inputFileSystem.purge) {
107
+ const fs = this.inputFileSystem;
108
+ for (const item of items) {
109
+ fs.purge(item);
110
+ }
111
+ }
112
+ return items;
113
+ }, "Watcher.getAggregatedChanges is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_GET_AGGREGATED_CHANGES"),
114
+ getFileTimeInfoEntries: util.deprecate(() => {
115
+ return fetchTimeInfo().fileTimeInfoEntries;
116
+ }, "Watcher.getFileTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_FILE_TIME_INFO_ENTRIES"),
117
+ getContextTimeInfoEntries: util.deprecate(() => {
118
+ return fetchTimeInfo().contextTimeInfoEntries;
119
+ }, "Watcher.getContextTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_CONTEXT_TIME_INFO_ENTRIES"),
120
+ getInfo: () => {
121
+ const removals = this.watcher && this.watcher.aggregatedRemovals;
122
+ const changes = this.watcher && this.watcher.aggregatedChanges;
123
+ if (this.inputFileSystem && this.inputFileSystem.purge) {
124
+ const fs = this.inputFileSystem;
125
+ if (removals) {
126
+ for (const item of removals) {
127
+ fs.purge(item);
128
+ }
129
+ }
130
+ if (changes) {
131
+ for (const item of changes) {
132
+ fs.purge(item);
133
+ }
134
+ }
135
+ }
136
+ const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo();
137
+ return {
138
+ changes,
139
+ removals,
140
+ fileTimeInfoEntries,
141
+ contextTimeInfoEntries
142
+ };
143
+ }
144
+ };
145
+ }
146
+ }
147
+ exports.NodeWatchFileSystem = NodeWatchFileSystem;
148
+ //# sourceMappingURL=NodeWatchFileSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeWatchFileSystem.js","sourceRoot":"","sources":["../../src/node/NodeWatchFileSystem.ts"],"names":[],"mappings":";AAAA;;;EAGE;;;AAEF,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEvC,MAAa,mBAAmB;IAI/B,YAAY,eAAe;QAC1B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG;YACrB,gBAAgB,EAAE,CAAC;SACnB,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CACJ,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,OAAO,EACP,QAAQ,EACR,iBAAiB;QAEjB,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,EAAE;YAC3D,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;SAC9C;QACD,IAAI,CAAC,WAAW,IAAI,OAAO,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,EAAE;YACvE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACpD;QACD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,EAAE;YAC/D,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SAChD;QACD,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;SACjD;QACD,IAAI,OAAO,SAAS,KAAK,QAAQ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KAAK,MAAM,IAAI,IAAI,OAAO,EAAE;4BAC3B,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;yBACf;qBACD;iBACD;gBACD,MAAM,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,GAAG,aAAa,EAAE,CAAC;gBACxE,OAAO;oBACN,OAAO;oBACP,QAAQ;oBACR,mBAAmB;oBACnB,sBAAsB;iBACtB,CAAC;YACH,CAAC;SACD,CAAC;IACH,CAAC;CACD;AAlLD,kDAkLC"}
@@ -0,0 +1 @@
1
+ !function(){var e={};self.__rspack_runtime__=e,e.installedModules={},e.installedChunks={},e.moduleCache={},e.checkById=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},e.publicPath="/",e.__rspack_require__=function(r){var n=this.moduleCache[r];if(void 0!==n)return n.exports;var t=this.moduleCache[r]={exports:{}};return this.installedModules[r](t,t.exports,this.__rspack_require__.bind(this),this.__rspack_dynamic_require__&&this.__rspack_dynamic_require__.bind(this),e),t.exports},e.__rspack_require__.i=[],e.__rspack_register__=function(e,r,n){if(e.some((function(e){return 0!==this.installedChunks[e]}).bind(this))){for(moduleId in r)this.checkById(r,moduleId)&&(this.installedModules[moduleId]=r[moduleId]);n&&n(this.__rspack_require__)}for(var t=0;t<e.length;t++)chunkId=e[t],this.checkById(this.installedChunks,chunkId)&&this.installedChunks[chunkId]&&this.installedChunks[chunkId][0](),this.installedChunks[chunkId]=0},function(){var r,n,t,i={},c=this.installedModules,u=[],o=[],s="idle",a=0,l=[];function d(e){s=e;for(var r=[],n=0;n<o.length;n++)r[n]=o[n].call(null,e);return Promise.all(r)}function f(){0==--a&&d("ready").then(function(){if(0===a){var e=l;l=[];for(var r=0;r<e.length;r++)e[r]()}})}function _(r){if("idle"===s)throw Error("check() is only allowed in idle status");return d("check").then(function(t){return t?d("prepare").then(function(){var i=[];return n=[],Promise.all(Object.keys(e.__rspack_require__.hmrC).reduce(function(r,c){e.__rspack_require__.hmrC[c](t.c,t.r,t.m,r,n,i)})).then(function(){var e;return e=function(){return r?h(r):d("ready").then(function(){return i})},0===a?e():new Promise(function(r){l.push(function(){r(e())})})})}):d(k()?"ready":"idle").then(function(){return null})})}function p(e){return"ready"!==s?Promise.resolve().then(function(){throw Error("apply() is only allowed in ready status (state: "+s+")")}):h(e)}function h(e){e=e||{},k();var r,i=n.map(function(r){return r(e)});n=void 0;var c=i.map(function(e){return e.errors}).filter(Boolean);if(c.length>0)return d("abort").then(function(){throw c[0]});var u=d("dispose");i.forEach(function(e){e.dispose&&e.dispose()});var o=d("apply"),s=function(e){r||(r=e)},a=[];return i.forEach(function(e){if(e.apply){var r=e.apply(s);if(r)for(var n=0;n<r.length;n++)a.push(r[n])}}),Promise.all([u,o]).then(function(){return r?d("fail").then(function(){throw r}):t?h(e).then(function(e){return a.forEach(function(r){0>e.indexOf(r)&&e.push(r)}),e}):d("idle").then(function(){return a})})}function k(){if(t)return n||(n=[]),Object.keys(e.__rspack_require__.hmrI).forEach(function(r){t.forEach(function(t){e.__rspack_require__.hmrI[r](t,n)})}),t=void 0,!0}e.__rspack_require__.hmrD=i,e.__rspack_require__.i.push(function(l){var h,k,y,v,m=l.module,b=function(e,n){var t=c[n];if(!t)return e;var i=function(i){if(t.hot.active){if(c[i]){var o=c[i].parents;-1===o.indexOf(n)&&o.push(n)}else u=[n],r=i;-1===t.children.indexOf(i)&&t.children.push(i)}else console.log("[HMR] unexpected require("+i+") from disposed module "+n),u=[];return e(i)},o=function(r){return{configurable:!0,enumerable:!0,get:function(){return e[r]},set:function(n){e[r]=n}}};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&"e"!==l&&Object.defineProperty(i,l,o(l));return i.e=function(r){return function(e){switch(s){case"ready":d("prepare");case"prepare":return a++,e.then(f,f),e;default:return e}}(e.e(r))},i}(l.require,l.id);m.hot=(h=l.id,k=m,v={_acceptedDependencies:{},_acceptedErrorHandlers:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_selfInvalidated:!1,_disposeHandlers:[],_main:y=r!==h,_requireSelf:function(){u=k.parents.slice(),r=y?void 0:h,e.__rspack_require__(h)},active:!0,accpet:function(e,r,n){if(void 0===e)v._selfAccepted=!0;else if("function"==typeof e)v._selfAccepted=e;else if("object"==typeof e&&null!==e)for(var t=0;t<e.length;t++)v._acceptedDependencies[e[t]]=r||function(){},v._acceptedErrorHandlers[e[t]]=n;else v._acceptedDependencies[e]=r||function(){},v._acceptedErrorHandlers[e]=n},decline:function(e){if(void 0===e)v._selfDeclined=!0;else if("object"==typeof e&&null!==e)for(var r=0;r<e.length;r++)v._declinedDependencies[e[r]]=!0;else v._declinedDependencies[e]=!0},dispose:function(e){v._disposeHandlers.push(e)},addDisposeHandler:function(e){v._disposeHandlers.push(e)},removeDisposeHandler:function(e){var r=v._disposeHandlers.indexOf(e);r>0&&v._disposeHandlers.splice(r,1)},invalidate:function(){switch(this._selfInvalidated=!0,s){case"idle":n=[],Object.keys(e.__rspack_require__.hmrI).forEach(function(r){e.__rspack_require__.hmrI[r](h,n)}),d("ready");break;case"ready":Object.keys(e.__rspack_require__.hmrI).forEach(function(r){e.__rspack_require__.hmrI[r](h,n)});break;case"prepare":case"check":case"dispose":case"apply":(t=t||[]).push(h)}},check:_,apply:p,status:function(e){if(!e)return s;o.push(e)},addStatusHandler:function(e){o.push(e)},removeStatusHandler:function(e){var r=o.indexOf(e);r>=0&&o.splice(r,1)},data:i[h]},r=void 0,v),m.parent=u,m.children=[],u=[],l.require=b}),e.__rspack_require__.hmrC={},e.__rspack_require__.hmrI={}}(),function(){function r(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,t=new WeakMap;return(r=function(e){return e?t:n})(e)}e.interopRequire=function(e,n){if(!n&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=r(n);if(t&&t.has(e))return t.get(e);var i={},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var o=c?Object.getOwnPropertyDescriptor(e,u):null;o&&(o.get||o.set)?Object.defineProperty(i,u,o):i[u]=e[u]}return i.default=e,t&&t.set(e,i),i}}(),e.exportStar=function(e,r){return Object.keys(e).forEach(function(n){"default"===n||Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})}),e}}();
@@ -0,0 +1,16 @@
1
+ import { Callback } from "tapable";
2
+ import { Compiler } from "./compiler";
3
+ import { ResolvedWatch, Watch } from "./config/watch";
4
+ import { Stats } from "./stats";
5
+ export declare class Watching {
6
+ compiler: Compiler;
7
+ watchOptions: ResolvedWatch;
8
+ watcher: any;
9
+ handler: Callback<Error, Stats>;
10
+ constructor(compiler: Compiler, watchOptions: Watch, handler: Callback<Error, Stats>);
11
+ _go(fileTimeInfoEntries: Iterable<string>, contextTimeInfoEntries: Iterable<string>, changedFiles: Iterable<string>, removedFiles: Iterable<string>): void;
12
+ _invalidate(fileTimeInfoEntries: Iterable<string>, contextTimeInfoEntries: Iterable<string>, changedFiles: Iterable<string>, removedFiles: Iterable<string>): void;
13
+ watch(files: Iterable<string>, dirs: Iterable<string>, missing: Iterable<string>): void;
14
+ close(): void;
15
+ }
16
+ //# sourceMappingURL=watching.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watching.d.ts","sourceRoot":"","sources":["../src/watching.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAsB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,QAAQ;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,aAAa,CAAC;IAC5B,OAAO,EAAE,GAAG,CAAC;IACpB,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAE/B,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,KAAK,EACnB,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAMhC,GAAG,CACF,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,EACrC,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC9B,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC;IAI/B,WAAW,CACV,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,EACrC,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC9B,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC;IAS/B,KAAK,CACJ,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,EACvB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EACtB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC;IAqB1B,KAAK;CACL"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Watching = void 0;
4
+ const watch_1 = require("./config/watch");
5
+ class Watching {
6
+ constructor(compiler, watchOptions, handler) {
7
+ this.compiler = compiler;
8
+ this.watchOptions = (0, watch_1.resolveWatchOption)(watchOptions);
9
+ this.handler = handler;
10
+ }
11
+ _go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) {
12
+ const run = () => { };
13
+ }
14
+ _invalidate(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) {
15
+ this._go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles);
16
+ }
17
+ watch(files, dirs, missing) {
18
+ this.watcher = this.compiler.watchFileSystem.watch(files, dirs, missing, undefined, this.watchOptions, (err, fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) => {
19
+ if (err) {
20
+ return this.handler(err);
21
+ }
22
+ });
23
+ }
24
+ close() { }
25
+ }
26
+ exports.Watching = Watching;
27
+ //# sourceMappingURL=watching.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watching.js","sourceRoot":"","sources":["../src/watching.ts"],"names":[],"mappings":";;;AAEA,0CAA0E;AAG1E,MAAa,QAAQ;IAKpB,YACC,QAAkB,EAClB,YAAmB,EACnB,OAA+B;QAE/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,IAAA,0BAAkB,EAAC,YAAY,CAAC,CAAC;QACrD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IACD,GAAG,CACF,mBAAqC,EACrC,sBAAwC,EACxC,YAA8B,EAC9B,YAA8B;QAE9B,MAAM,GAAG,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;IACtB,CAAC;IACD,WAAW,CACV,mBAAqC,EACrC,sBAAwC,EACxC,YAA8B,EAC9B,YAA8B;QAE9B,IAAI,CAAC,GAAG,CACP,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,YAAY,CACZ,CAAC;IACH,CAAC;IACD,KAAK,CACJ,KAAuB,EACvB,IAAsB,EACtB,OAAyB;QAEzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,CACjD,KAAK,EACL,IAAI,EACJ,OAAO,EACP,SAAS,EACT,IAAI,CAAC,YAAY,EACjB,CACC,GAAU,EACV,mBAAqC,EACrC,sBAAwC,EACxC,YAA8B,EAC9B,YAA8B,EAC7B,EAAE;YACH,IAAI,GAAG,EAAE;gBACR,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;aACzB;QACF,CAAC,CACD,CAAC;IACH,CAAC;IACD,KAAK,KAAI,CAAC;CACV;AA5DD,4BA4DC"}
@@ -0,0 +1,5 @@
1
+ import { Compiler } from "../compiler";
2
+ export declare class NodeShimPlugin {
3
+ apply(compiler: Compiler): void;
4
+ }
5
+ //# sourceMappingURL=nodeShim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeShim.d.ts","sourceRoot":"","sources":["../../src/web/nodeShim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA+BvC,qBAAa,cAAc;IAC1B,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAMxB"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NodeShimPlugin = void 0;
4
+ const PolyfilledBuiltinModules = {
5
+ assert: "assert/",
6
+ buffer: "buffer/",
7
+ console: "console-browserify",
8
+ constants: "constants-browserify",
9
+ crypto: "crypto-browserify",
10
+ domain: "domain-browser",
11
+ events: "events/",
12
+ http: "stream-http",
13
+ https: "https-browserify",
14
+ os: "os-browserify/browser",
15
+ path: "path-browserify",
16
+ punycode: "punycode/",
17
+ process: "process/browser",
18
+ querystring: "querystring-es3",
19
+ stream: "stream-browserify",
20
+ _stream_duplex: "readable-stream/duplex",
21
+ _stream_passthrough: "readable-stream/passthrough",
22
+ _stream_readable: "readable-stream/readable",
23
+ _stream_transform: "readable-stream/transform",
24
+ _stream_writable: "readable-stream/writable",
25
+ string_decoder: "string_decoder/",
26
+ sys: "util/",
27
+ timers: "timers-browserify",
28
+ tty: "tty-browserify",
29
+ url: "url/",
30
+ util: "util/",
31
+ vm: "vm-browserify",
32
+ zlib: "browserify-zlib"
33
+ };
34
+ class NodeShimPlugin {
35
+ apply(compiler) {
36
+ compiler.options.resolve.alias = {
37
+ ...PolyfilledBuiltinModules,
38
+ ...compiler.options.resolve.alias
39
+ };
40
+ }
41
+ }
42
+ exports.NodeShimPlugin = NodeShimPlugin;
43
+ //# sourceMappingURL=nodeShim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeShim.js","sourceRoot":"","sources":["../../src/web/nodeShim.ts"],"names":[],"mappings":";;;AACA,MAAM,wBAAwB,GAAG;IAChC,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,oBAAoB;IAC7B,SAAS,EAAE,sBAAsB;IACjC,MAAM,EAAE,mBAAmB;IAC3B,MAAM,EAAE,gBAAgB;IACxB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,kBAAkB;IACzB,EAAE,EAAE,uBAAuB;IAC3B,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,iBAAiB;IAC9B,MAAM,EAAE,mBAAmB;IAC3B,cAAc,EAAE,wBAAwB;IACxC,mBAAmB,EAAE,6BAA6B;IAClD,gBAAgB,EAAE,0BAA0B;IAC5C,iBAAiB,EAAE,2BAA2B;IAC9C,gBAAgB,EAAE,0BAA0B;IAC5C,cAAc,EAAE,iBAAiB;IACjC,GAAG,EAAE,OAAO;IACZ,MAAM,EAAE,mBAAmB;IAC3B,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,OAAO;IACb,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,iBAAiB;CACvB,CAAC;AACF,MAAa,cAAc;IAC1B,KAAK,CAAC,QAAkB;QACvB,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG;YAChC,GAAG,wBAAwB;YAC3B,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK;SACjC,CAAC;IACH,CAAC;CACD;AAPD,wCAOC"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.0.0-20221102114315",
3
+ "version": "0.0.0-20221103045015",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
9
  "devDependencies": {
10
- "@rspack/core": "0.0.0-20221102114315",
10
+ "@rspack/core": "0.0.0-20221103045015",
11
11
  "@swc/helpers": "^0.4.12",
12
12
  "@types/jest": "29.0.2",
13
13
  "@types/node": "^18.6.3",
@@ -24,10 +24,10 @@
24
24
  "util": "0.12.5"
25
25
  },
26
26
  "dependencies": {
27
- "@rspack/binding": "0.0.0-20221102114315",
28
- "@rspack/dev-client": "0.0.0-20221102114315",
29
- "@rspack/plugin-less": "^0.0.0-20221102114315",
30
- "@rspack/plugin-postcss": "^0.0.0-20221102114315",
27
+ "@rspack/binding": "0.0.0-20221103045015",
28
+ "@rspack/dev-client": "0.0.0-20221103045015",
29
+ "@rspack/plugin-less": "^0.0.0-20221103045015",
30
+ "@rspack/plugin-postcss": "^0.0.0-20221103045015",
31
31
  "browserslist": "^4.21.3",
32
32
  "chokidar": "3.5.3",
33
33
  "tapable": "2.2.1",