@unpackjs/core 1.6.4 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/compiled/css-loader/index.js +46 -46
  2. package/compiled/less-loader/index.js +8 -8
  3. package/compiled/postcss-loader/index.js +11 -11
  4. package/compiled/sass-loader/index.js +8 -8
  5. package/dist/bundler-config/index.cjs +9 -6
  6. package/dist/bundler-config/index.d.ts.map +1 -1
  7. package/dist/bundler-config/index.js +12 -9
  8. package/dist/createUnpack.cjs +6 -3
  9. package/dist/createUnpack.d.ts.map +1 -1
  10. package/dist/createUnpack.js +7 -4
  11. package/dist/index.cjs +3 -0
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +2 -0
  15. package/dist/plugin-progress/rspack.cjs +3 -1
  16. package/dist/plugin-progress/rspack.d.ts.map +1 -1
  17. package/dist/plugin-progress/rspack.js +3 -1
  18. package/dist/plugin-progress/webpack.cjs +3 -1
  19. package/dist/plugin-progress/webpack.d.ts.map +1 -1
  20. package/dist/plugin-progress/webpack.js +3 -1
  21. package/dist/prebundleDeps.cjs +340 -0
  22. package/dist/prebundleDeps.d.ts +5 -0
  23. package/dist/prebundleDeps.d.ts.map +1 -0
  24. package/dist/prebundleDeps.js +324 -0
  25. package/dist/run/dev.cjs +22 -39
  26. package/dist/run/dev.d.ts +1 -1
  27. package/dist/run/dev.d.ts.map +1 -1
  28. package/dist/run/dev.js +23 -40
  29. package/dist/thread-loader/worker.js +1 -1
  30. package/dist/types/config.d.ts +29 -6
  31. package/dist/types/config.d.ts.map +1 -1
  32. package/dist/utils.cjs +2 -0
  33. package/dist/utils.d.ts +2 -0
  34. package/dist/utils.d.ts.map +1 -1
  35. package/dist/utils.js +1 -0
  36. package/package.json +5 -8
  37. package/compiled/chokidar/index.d.ts +0 -327
  38. package/compiled/chokidar/index.js +0 -1773
  39. package/compiled/chokidar/license +0 -21
  40. package/compiled/chokidar/package.json +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unpackjs/core",
3
- "version": "1.6.4",
3
+ "version": "1.7.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -52,10 +52,6 @@
52
52
  "./style-loader": {
53
53
  "types": "./compiled/style-loader/index.d.ts",
54
54
  "default": "./compiled/style-loader/index.js"
55
- },
56
- "./chokidar": {
57
- "types": "./compiled/chokidar/index.d.ts",
58
- "default": "./compiled/chokidar/index.js"
59
55
  }
60
56
  },
61
57
  "main": "./dist/index.cjs",
@@ -73,7 +69,6 @@
73
69
  },
74
70
  "devDependencies": {
75
71
  "@types/sass-loader": "8.0.9",
76
- "chokidar": "4.0.1",
77
72
  "commander": "12.1.0",
78
73
  "css-loader": "7.1.2",
79
74
  "less-loader": "12.2.0",
@@ -87,11 +82,13 @@
87
82
  "webpack-merge": "6.0.1"
88
83
  },
89
84
  "dependencies": {
90
- "@rspack/core": "1.1.0",
85
+ "@rspack/core": "1.1.1",
91
86
  "@types/less": "3.0.6",
92
87
  "copy-webpack-plugin": "12.0.2",
88
+ "cors": "2.8.5",
93
89
  "esbuild": "0.24.0",
94
90
  "esbuild-loader": "4.2.2",
91
+ "express": "4.21.1",
95
92
  "fork-ts-checker-webpack-plugin": "9.0.2",
96
93
  "html-webpack-plugin": "5.6.3",
97
94
  "json5": "2.2.3",
@@ -101,7 +98,7 @@
101
98
  "neo-async": "2.6.2",
102
99
  "open": "8.4.2",
103
100
  "picocolors": "1.1.1",
104
- "postcss": "8.4.47",
101
+ "postcss": "8.4.49",
105
102
  "tinyglobby": "0.2.10",
106
103
  "typed-css-modules": "0.9.1",
107
104
  "webpack": "5.96.1",
@@ -1,327 +0,0 @@
1
- import { Stats, Dirent } from 'fs';
2
- import { EventEmitter } from 'events';
3
- import { Readable } from 'stream';
4
-
5
- type Path$1 = string;
6
- interface EntryInfo {
7
- path: string;
8
- fullPath: string;
9
- stats?: Stats;
10
- dirent?: Dirent;
11
- basename: string;
12
- }
13
- type PathOrDirent = Dirent | Path$1;
14
- type Tester = (path: EntryInfo) => boolean;
15
- declare function defaultOptions(): {
16
- root: string;
17
- fileFilter: (_path: EntryInfo) => boolean;
18
- directoryFilter: (_path: EntryInfo) => boolean;
19
- type: string;
20
- lstat: boolean;
21
- depth: number;
22
- alwaysStat: boolean;
23
- highWaterMark: number;
24
- };
25
- type ReaddirpOptions = ReturnType<typeof defaultOptions>;
26
- interface DirEntry$1 {
27
- files: PathOrDirent[];
28
- depth: number;
29
- path: Path$1;
30
- }
31
- declare class ReaddirpStream extends Readable {
32
- parents: any[];
33
- reading: boolean;
34
- parent?: DirEntry$1;
35
- _stat: Function;
36
- _maxDepth: number;
37
- _wantsDir: boolean;
38
- _wantsFile: boolean;
39
- _wantsEverything: boolean;
40
- _root: Path$1;
41
- _isDirent: boolean;
42
- _statsProp: 'dirent' | 'stats';
43
- _rdOptions: {
44
- encoding: 'utf8';
45
- withFileTypes: boolean;
46
- };
47
- _fileFilter: Tester;
48
- _directoryFilter: Tester;
49
- constructor(options?: Partial<ReaddirpOptions>);
50
- _read(batch: number): Promise<void>;
51
- _exploreDir(path: Path$1, depth: number): Promise<{
52
- files: string[] | undefined;
53
- depth: number;
54
- path: string;
55
- }>;
56
- _formatEntry(dirent: PathOrDirent, path: Path$1): EntryInfo | undefined;
57
- _onError(err: Error): void;
58
- _getEntryType(entry: EntryInfo): Promise<void | "" | "file" | "directory">;
59
- _includeAsFile(entry: EntryInfo): boolean | undefined;
60
- }
61
-
62
- type Path = string;
63
- declare const EVENTS: {
64
- readonly ALL: "all";
65
- readonly READY: "ready";
66
- readonly ADD: "add";
67
- readonly CHANGE: "change";
68
- readonly ADD_DIR: "addDir";
69
- readonly UNLINK: "unlink";
70
- readonly UNLINK_DIR: "unlinkDir";
71
- readonly RAW: "raw";
72
- readonly ERROR: "error";
73
- };
74
- type EventName = (typeof EVENTS)[keyof typeof EVENTS];
75
- /**
76
- * @mixin
77
- */
78
- declare class NodeFsHandler {
79
- fsw: FSWatcher;
80
- _boundHandleError: (error: unknown) => void;
81
- constructor(fsW: FSWatcher);
82
- /**
83
- * Watch file for changes with fs_watchFile or fs_watch.
84
- * @param path to file or dir
85
- * @param listener on fs change
86
- * @returns closer for the watcher instance
87
- */
88
- _watchWithNodeFs(path: string, listener: (path: string, newStats?: any) => void | Promise<void>): (() => void) | undefined;
89
- /**
90
- * Watch a file and emit add event if warranted.
91
- * @returns closer for the watcher instance
92
- */
93
- _handleFile(file: Path, stats: Stats, initialAdd: boolean): (() => void) | undefined;
94
- /**
95
- * Handle symlinks encountered while reading a dir.
96
- * @param entry returned by readdirp
97
- * @param directory path of dir being read
98
- * @param path of this item
99
- * @param item basename of this item
100
- * @returns true if no more processing is needed for this entry.
101
- */
102
- _handleSymlink(entry: EntryInfo, directory: string, path: Path, item: string): Promise<boolean | undefined>;
103
- _handleRead(directory: string, initialAdd: boolean, wh: WatchHelper, target: Path, dir: Path, depth: number, throttler: Throttler): Promise<unknown> | undefined;
104
- /**
105
- * Read directory to add / remove files from `@watched` list and re-read it on change.
106
- * @param dir fs path
107
- * @param stats
108
- * @param initialAdd
109
- * @param depth relative to user-supplied path
110
- * @param target child path targeted for watch
111
- * @param wh Common watch helpers for this path
112
- * @param realpath
113
- * @returns closer for the watcher instance.
114
- */
115
- _handleDir(dir: string, stats: Stats, initialAdd: boolean, depth: number, target: string, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
116
- /**
117
- * Handle added file, directory, or glob pattern.
118
- * Delegates call to _handleFile / _handleDir after checks.
119
- * @param path to file or ir
120
- * @param initialAdd was the file added at watch instantiation?
121
- * @param priorWh depth relative to user-supplied path
122
- * @param depth Child path actually targeted for watch
123
- * @param target Child path actually targeted for watch
124
- */
125
- _addToNodeFs(path: string, initialAdd: boolean, priorWh: WatchHelper | undefined, depth: number, target?: string): Promise<string | false | undefined>;
126
- }
127
-
128
- type AWF = {
129
- stabilityThreshold: number;
130
- pollInterval: number;
131
- };
132
- type BasicOpts = {
133
- persistent: boolean;
134
- ignoreInitial: boolean;
135
- followSymlinks: boolean;
136
- cwd?: string;
137
- usePolling: boolean;
138
- interval: number;
139
- binaryInterval: number;
140
- alwaysStat?: boolean;
141
- depth?: number;
142
- ignorePermissionErrors: boolean;
143
- atomic: boolean | number;
144
- };
145
- type Throttler = {
146
- timeoutObject: NodeJS.Timeout;
147
- clear: () => void;
148
- count: number;
149
- };
150
- type ChokidarOptions = Partial<BasicOpts & {
151
- ignored: Matcher | Matcher[];
152
- awaitWriteFinish: boolean | Partial<AWF>;
153
- }>;
154
- type FSWInstanceOptions = BasicOpts & {
155
- ignored: Matcher[];
156
- awaitWriteFinish: false | AWF;
157
- };
158
- type ThrottleType = 'readdir' | 'watch' | 'add' | 'remove' | 'change';
159
- type EmitArgs = [EventName, Path | Error, any?, any?, any?];
160
- type MatchFunction = (val: string, stats?: Stats) => boolean;
161
- interface MatcherObject {
162
- path: string;
163
- recursive?: boolean;
164
- }
165
- type Matcher = string | RegExp | MatchFunction | MatcherObject;
166
- /**
167
- * Directory entry.
168
- */
169
- declare class DirEntry {
170
- path: Path;
171
- _removeWatcher: (dir: string, base: string) => void;
172
- items: Set<Path>;
173
- constructor(dir: Path, removeWatcher: (dir: string, base: string) => void);
174
- add(item: string): void;
175
- remove(item: string): Promise<void>;
176
- has(item: string): boolean | undefined;
177
- getChildren(): string[];
178
- dispose(): void;
179
- }
180
- declare class WatchHelper {
181
- fsw: FSWatcher;
182
- path: string;
183
- watchPath: string;
184
- fullWatchPath: string;
185
- dirParts: string[][];
186
- followSymlinks: boolean;
187
- statMethod: 'stat' | 'lstat';
188
- constructor(path: string, follow: boolean, fsw: FSWatcher);
189
- entryPath(entry: EntryInfo): Path;
190
- filterPath(entry: EntryInfo): boolean;
191
- filterDir(entry: EntryInfo): boolean;
192
- }
193
- /**
194
- * Watches files & directories for changes. Emitted events:
195
- * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
196
- *
197
- * new FSWatcher()
198
- * .add(directories)
199
- * .on('add', path => log('File', path, 'was added'))
200
- */
201
- declare class FSWatcher extends EventEmitter {
202
- closed: boolean;
203
- options: FSWInstanceOptions;
204
- _closers: Map<string, Array<any>>;
205
- _ignoredPaths: Set<Matcher>;
206
- _throttled: Map<ThrottleType, Map<any, any>>;
207
- _streams: Set<ReaddirpStream>;
208
- _symlinkPaths: Map<Path, string | boolean>;
209
- _watched: Map<string, DirEntry>;
210
- _pendingWrites: Map<string, any>;
211
- _pendingUnlinks: Map<string, EmitArgs>;
212
- _readyCount: number;
213
- _emitReady: () => void;
214
- _closePromise?: Promise<void>;
215
- _userIgnored?: MatchFunction;
216
- _readyEmitted: boolean;
217
- _emitRaw: () => void;
218
- _boundRemove: (dir: string, item: string) => void;
219
- _nodeFsHandler: NodeFsHandler;
220
- constructor(_opts?: ChokidarOptions);
221
- _addIgnoredPath(matcher: Matcher): void;
222
- _removeIgnoredPath(matcher: Matcher): void;
223
- /**
224
- * Adds paths to be watched on an existing FSWatcher instance.
225
- * @param paths_ file or file list. Other arguments are unused
226
- */
227
- add(paths_: Path | Path[], _origAdd?: string, _internal?: boolean): FSWatcher;
228
- /**
229
- * Close watchers or start ignoring events from specified paths.
230
- */
231
- unwatch(paths_: Path | Path[]): FSWatcher;
232
- /**
233
- * Close watchers and remove all listeners from watched paths.
234
- */
235
- close(): Promise<void>;
236
- /**
237
- * Expose list of watched paths
238
- * @returns for chaining
239
- */
240
- getWatched(): Record<string, string[]>;
241
- emitWithAll(event: EventName, args: EmitArgs): void;
242
- /**
243
- * Normalize and emit events.
244
- * Calling _emit DOES NOT MEAN emit() would be called!
245
- * @param event Type of event
246
- * @param path File or directory path
247
- * @param stats arguments to be passed with event
248
- * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
249
- */
250
- _emit(event: EventName, path: Path, stats?: Stats): Promise<this | undefined>;
251
- /**
252
- * Common handler for errors
253
- * @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
254
- */
255
- _handleError(error: Error): Error | boolean;
256
- /**
257
- * Helper utility for throttling
258
- * @param actionType type being throttled
259
- * @param path being acted upon
260
- * @param timeout duration of time to suppress duplicate actions
261
- * @returns tracking object or false if action should be suppressed
262
- */
263
- _throttle(actionType: ThrottleType, path: Path, timeout: number): Throttler | false;
264
- _incrReadyCount(): number;
265
- /**
266
- * Awaits write operation to finish.
267
- * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
268
- * @param path being acted upon
269
- * @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
270
- * @param event
271
- * @param awfEmit Callback to be called when ready for event to be emitted.
272
- */
273
- _awaitWriteFinish(path: Path, threshold: number, event: EventName, awfEmit: (err?: Error, stat?: Stats) => void): void;
274
- /**
275
- * Determines whether user has asked to ignore this path.
276
- */
277
- _isIgnored(path: Path, stats?: Stats): boolean;
278
- _isntIgnored(path: Path, stat?: Stats): boolean;
279
- /**
280
- * Provides a set of common helpers and properties relating to symlink handling.
281
- * @param path file or directory pattern being watched
282
- */
283
- _getWatchHelpers(path: Path): WatchHelper;
284
- /**
285
- * Provides directory tracking objects
286
- * @param directory path of the directory
287
- */
288
- _getWatchedDir(directory: string): DirEntry;
289
- /**
290
- * Check for read permissions: https://stackoverflow.com/a/11781404/1358405
291
- */
292
- _hasReadPermissions(stats: Stats): boolean;
293
- /**
294
- * Handles emitting unlink events for
295
- * files and directories, and via recursion, for
296
- * files and directories within directories that are unlinked
297
- * @param directory within which the following item is located
298
- * @param item base path of item/directory
299
- */
300
- _remove(directory: string, item: string, isDirectory?: boolean): void;
301
- /**
302
- * Closes all watchers for a path
303
- */
304
- _closePath(path: Path): void;
305
- /**
306
- * Closes only file-specific watchers
307
- */
308
- _closeFile(path: Path): void;
309
- _addPathCloser(path: Path, closer: () => void): void;
310
- _readdirp(root: Path, opts?: Partial<ReaddirpOptions>): ReaddirpStream | undefined;
311
- }
312
- /**
313
- * Instantiates watcher with paths to be tracked.
314
- * @param paths file / directory paths
315
- * @param options opts, such as `atomic`, `awaitWriteFinish`, `ignored`, and others
316
- * @returns an instance of FSWatcher for chaining.
317
- * @example
318
- * const watcher = watch('.').on('all', (event, path) => { console.log(event, path); });
319
- * watch('.', { atomic: true, awaitWriteFinish: true, ignored: (f, stats) => stats?.isFile() && !f.endsWith('.js') })
320
- */
321
- declare function watch(paths: string | string[], options?: ChokidarOptions): FSWatcher;
322
- declare const _default: {
323
- watch: typeof watch;
324
- FSWatcher: typeof FSWatcher;
325
- };
326
-
327
- export { type ChokidarOptions, type EmitArgs, type FSWInstanceOptions, FSWatcher, type MatchFunction, type Matcher, type MatcherObject, type ThrottleType, type Throttler, WatchHelper, _default as default, watch };