@rspack/core 0.5.6 → 0.5.7-canary-3320ea8-20240312032922

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.
@@ -631,6 +631,9 @@ const SIMPLE_EXTRACTORS = {
631
631
  else {
632
632
  object.providedExports = null;
633
633
  }
634
+ },
635
+ optimizationBailout: (object, module) => {
636
+ object.optimizationBailout = module.optimizationBailout || null;
634
637
  }
635
638
  },
636
639
  profile: {
@@ -9,10 +9,11 @@ export type StatsChunkGroup = binding.JsStatsChunkGroup & Record<string, any>;
9
9
  export type KnownStatsAsset = binding.JsStatsAsset;
10
10
  export type StatsAsset = KnownStatsAsset & Record<string, any>;
11
11
  export type StatsChunk = KnownStatsChunk & Record<string, any>;
12
- export type KnownStatsModule = Omit<binding.JsStatsModule, "usedExports" | "providedExports"> & {
12
+ export type KnownStatsModule = Omit<binding.JsStatsModule, "usedExports" | "providedExports" | "optimizationBailout"> & {
13
13
  profile?: StatsProfile;
14
14
  usedExports?: null | string[] | boolean;
15
15
  providedExports?: null | string[];
16
+ optimizationBailout?: null | string[];
16
17
  };
17
18
  export type StatsProfile = KnownStatsProfile & Record<string, any>;
18
19
  export type KnownStatsProfile = {
@@ -1,41 +1,6 @@
1
- import { Compilation, Assets } from "..";
2
- import * as tapable from "tapable";
3
- export declare const createFakeProcessAssetsHook: (compilation: Compilation) => {
4
- name: string;
5
- tap: (options: string | {
6
- name: string;
7
- stage?: number | undefined;
8
- }, fn: (assets: Assets) => void) => void;
9
- tapAsync: (options: string | {
10
- name: string;
11
- stage?: number | undefined;
12
- }, fn: (assets: Assets, cb: tapable.InnerCallback<Error, void>) => void) => void;
13
- tapPromise: (options: string | {
14
- name: string;
15
- stage?: number | undefined;
16
- }, fn: (assets: Assets) => Promise<void>) => void;
17
- stageAdditional: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
18
- stagePreProcess: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
19
- stageDerived: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
20
- stageAdditions: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
21
- stageNone: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
22
- stageOptimize: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
23
- stageOptimizeCount: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
24
- stageOptimizeCompatibility: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
25
- stageOptimizeSize: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
26
- stageDevTooling: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
27
- stageOptimizeInline: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
28
- stageSummarize: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
29
- stageOptimizeHash: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
30
- stageOptimizeTransfer: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
31
- stageAnalyse: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
32
- stageReport: tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
33
- };
34
1
  export type FakeHook<T> = T & {
35
2
  _fakeHook: true;
36
3
  };
37
- export declare const createFakeHook: <T extends object>(fakeHook: T) => FakeHook<T>;
38
- export declare const createProcessAssetsHook: <T>(processAssetsHooks: ReturnType<typeof createFakeProcessAssetsHook>, name: string, stage: number, getArgs: () => tapable.AsArray<T>) => FakeHook<Pick<tapable.AsyncSeriesHook<T, tapable.UnsetAdditionalOptions>, "name" | "tap" | "tapAsync" | "tapPromise">>;
39
4
  export declare function createFakeCompilationDependencies(getDeps: () => string[], addDeps: (deps: string[]) => void): {
40
5
  [Symbol.iterator](): Generator<string, void, unknown>;
41
6
  has(dep: string): boolean;
package/dist/util/fake.js CHANGED
@@ -1,104 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.createFakeCompilationDependencies = exports.createProcessAssetsHook = exports.createFakeHook = exports.createFakeProcessAssetsHook = void 0;
30
- const tapable = __importStar(require("tapable"));
6
+ exports.createFakeCompilationDependencies = void 0;
31
7
  const MergeCaller_1 = __importDefault(require("./MergeCaller"));
32
- const createFakeProcessAssetsHook = (compilation) => {
33
- const createFakeTap = (options,
34
- // @ts-expect-error
35
- fn, tap) => {
36
- var _a;
37
- if (typeof options === "string")
38
- options = { name: options };
39
- const hook = compilation.__internal_getProcessAssetsHookByStage((_a = options.stage) !== null && _a !== void 0 ? _a : 0);
40
- // @ts-expect-error
41
- hook[tap](options.name, fn);
42
- };
43
- return {
44
- name: "processAssets",
45
- tap: (options, fn) => createFakeTap(options, fn, "tap"),
46
- tapAsync: (options, fn) => createFakeTap(options, fn, "tapAsync"),
47
- tapPromise: (options, fn) => createFakeTap(options, fn, "tapPromise"),
48
- stageAdditional: new tapable.AsyncSeriesHook(["assets"]),
49
- stagePreProcess: new tapable.AsyncSeriesHook(["assets"]),
50
- stageDerived: new tapable.AsyncSeriesHook(["assets"]),
51
- stageAdditions: new tapable.AsyncSeriesHook(["assets"]),
52
- stageNone: new tapable.AsyncSeriesHook(["assets"]),
53
- stageOptimize: new tapable.AsyncSeriesHook(["assets"]),
54
- stageOptimizeCount: new tapable.AsyncSeriesHook(["assets"]),
55
- stageOptimizeCompatibility: new tapable.AsyncSeriesHook(["assets"]),
56
- stageOptimizeSize: new tapable.AsyncSeriesHook(["assets"]),
57
- stageDevTooling: new tapable.AsyncSeriesHook(["assets"]),
58
- stageOptimizeInline: new tapable.AsyncSeriesHook(["assets"]),
59
- stageSummarize: new tapable.AsyncSeriesHook(["assets"]),
60
- stageOptimizeHash: new tapable.AsyncSeriesHook(["assets"]),
61
- stageOptimizeTransfer: new tapable.AsyncSeriesHook(["assets"]),
62
- stageAnalyse: new tapable.AsyncSeriesHook(["assets"]),
63
- stageReport: new tapable.AsyncSeriesHook(["assets"])
64
- };
65
- };
66
- exports.createFakeProcessAssetsHook = createFakeProcessAssetsHook;
67
- const createFakeHook = (fakeHook) => {
68
- return Object.freeze(Object.assign(fakeHook, { _fakeHook: true }));
69
- };
70
- exports.createFakeHook = createFakeHook;
71
- const createProcessAssetsHook = (processAssetsHooks, name, stage, getArgs) => {
72
- const errorMessage = (reason) => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
73
- BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
74
- const getOptions = (options) => {
75
- if (typeof options === "string")
76
- options = { name: options };
77
- if (options.stage) {
78
- throw new Error(errorMessage("it's using the 'stage' option"));
79
- }
80
- return { ...options, stage: stage };
81
- };
82
- const tap = (options, fn) => {
83
- processAssetsHooks.tap(getOptions(options), () => fn(...getArgs()));
84
- };
85
- const tapAsync = (options, fn) => {
86
- processAssetsHooks.tapAsync(getOptions(options), (assets, callback) => fn(...getArgs(), callback));
87
- };
88
- const tapPromise = (options, fn) => {
89
- processAssetsHooks.tapPromise(getOptions(options), () => fn(...getArgs()));
90
- };
91
- return (0, exports.createFakeHook)({
92
- name,
93
- intercept() {
94
- throw new Error(errorMessage("it's using 'intercept'"));
95
- },
96
- tap,
97
- tapAsync,
98
- tapPromise
99
- });
100
- };
101
- exports.createProcessAssetsHook = createProcessAssetsHook;
102
8
  function createFakeCompilationDependencies(getDeps, addDeps) {
103
9
  const addDepsCaller = new MergeCaller_1.default(addDeps, 10);
104
10
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.5.6",
3
+ "version": "0.5.7-canary-3320ea8-20240312032922",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -29,6 +29,7 @@
29
29
  "directory": "packages/rspack"
30
30
  },
31
31
  "devDependencies": {
32
+ "@swc/plugin-remove-console": "^1.5.114",
32
33
  "@types/watchpack": "^2.4.0",
33
34
  "@types/webpack-sources": "3.2.3",
34
35
  "@types/ws": "8.5.10",
@@ -54,9 +55,9 @@
54
55
  "styled-components": "^6.0.8",
55
56
  "terser": "5.27.2",
56
57
  "wast-loader": "^1.11.4",
57
- "@rspack/plugin-minify": "^0.5.6",
58
- "@rspack/plugin-node-polyfill": "^0.5.6",
59
- "@rspack/core": "0.5.6"
58
+ "@rspack/plugin-node-polyfill": "^0.5.7-canary-3320ea8-20240312032922",
59
+ "@rspack/core": "0.5.7-canary-3320ea8-20240312032922",
60
+ "@rspack/plugin-minify": "^0.5.7-canary-3320ea8-20240312032922"
60
61
  },
61
62
  "dependencies": {
62
63
  "@module-federation/runtime-tools": "0.0.8",
@@ -71,7 +72,7 @@
71
72
  "webpack-sources": "3.2.3",
72
73
  "zod": "^3.21.4",
73
74
  "zod-validation-error": "1.3.1",
74
- "@rspack/binding": "0.5.6"
75
+ "@rspack/binding": "0.5.7-canary-3320ea8-20240312032922"
75
76
  },
76
77
  "peerDependencies": {
77
78
  "@swc/helpers": ">=0.5.1"
@@ -84,6 +85,6 @@
84
85
  "scripts": {
85
86
  "build": "tsc -b ./tsconfig.build.json",
86
87
  "dev": "tsc -w",
87
- "test": "cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --testPathIgnorePatterns \".diff.test.ts\" --logHeapUsage"
88
+ "test": "cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage"
88
89
  }
89
90
  }