@docusaurus/bundler 0.0.0-6112 → 0.0.0-6115
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/lib/importFaster.d.ts +3 -3
- package/lib/importFaster.d.ts.map +1 -1
- package/lib/importFaster.js +11 -6
- package/lib/importFaster.js.map +1 -1
- package/lib/loaders/jsLoader.d.ts.map +1 -1
- package/lib/loaders/jsLoader.js +22 -19
- package/lib/loaders/jsLoader.js.map +1 -1
- package/lib/minification.d.ts.map +1 -1
- package/lib/minification.js +2 -1
- package/lib/minification.js.map +1 -1
- package/package.json +7 -7
- package/src/importFaster.ts +12 -6
- package/src/loaders/jsLoader.ts +28 -20
- package/src/minification.ts +3 -2
package/lib/importFaster.d.ts
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type { ConfigureWebpackUtils } from '@docusaurus/types';
|
|
8
7
|
import type { MinimizerOptions as JsMinimizerOptions, CustomOptions } from 'terser-webpack-plugin';
|
|
9
8
|
import type { MinimizerOptions as CssMinimizerOptions } from 'css-minimizer-webpack-plugin';
|
|
10
9
|
export type FasterModule = Awaited<typeof import('@docusaurus/faster')>;
|
|
11
10
|
export declare function importRspack(): Promise<FasterModule['rspack']>;
|
|
12
|
-
export declare function
|
|
11
|
+
export declare function importSwcLoader(): Promise<string>;
|
|
12
|
+
export declare function importGetSwcLoaderOptions(): Promise<FasterModule['getSwcLoaderOptions']>;
|
|
13
13
|
export declare function importSwcJsMinimizerOptions(): Promise<JsMinimizerOptions<CustomOptions>>;
|
|
14
14
|
export declare function importSwcHtmlMinifier(): Promise<ReturnType<FasterModule['getSwcHtmlMinifier']>>;
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function importGetBrowserslistQueries(): Promise<FasterModule['getBrowserslistQueries']>;
|
|
16
16
|
export declare function importLightningCssMinimizerOptions(): Promise<CssMinimizerOptions<CustomOptions>>;
|
|
17
17
|
//# sourceMappingURL=importFaster.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importFaster.d.ts","sourceRoot":"","sources":["../src/importFaster.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"importFaster.d.ts","sourceRoot":"","sources":["../src/importFaster.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,gBAAgB,IAAI,kBAAkB,EACtC,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAC,gBAAgB,IAAI,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AAE1F,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,oBAAoB,CAAC,CAAC,CAAC;AAiBxE,wBAAsB,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAGpE;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAGvD;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CACxD,YAAY,CAAC,qBAAqB,CAAC,CACpC,CAGA;AAED,wBAAsB,2BAA2B,IAAI,OAAO,CAC1D,kBAAkB,CAAC,aAAa,CAAC,CAClC,CAGA;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CACpD,UAAU,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,CAC/C,CAGA;AAED,wBAAsB,4BAA4B,IAAI,OAAO,CAC3D,YAAY,CAAC,wBAAwB,CAAC,CACvC,CAGA;AAED,wBAAsB,kCAAkC,IAAI,OAAO,CACjE,mBAAmB,CAAC,aAAa,CAAC,CACnC,CAGA"}
|
package/lib/importFaster.js
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.importRspack = importRspack;
|
|
10
|
-
exports.
|
|
10
|
+
exports.importSwcLoader = importSwcLoader;
|
|
11
|
+
exports.importGetSwcLoaderOptions = importGetSwcLoaderOptions;
|
|
11
12
|
exports.importSwcJsMinimizerOptions = importSwcJsMinimizerOptions;
|
|
12
13
|
exports.importSwcHtmlMinifier = importSwcHtmlMinifier;
|
|
13
|
-
exports.
|
|
14
|
+
exports.importGetBrowserslistQueries = importGetBrowserslistQueries;
|
|
14
15
|
exports.importLightningCssMinimizerOptions = importLightningCssMinimizerOptions;
|
|
15
16
|
async function importFaster() {
|
|
16
17
|
return import('@docusaurus/faster');
|
|
@@ -27,9 +28,13 @@ async function importRspack() {
|
|
|
27
28
|
const faster = await ensureFaster();
|
|
28
29
|
return faster.rspack;
|
|
29
30
|
}
|
|
30
|
-
async function
|
|
31
|
+
async function importSwcLoader() {
|
|
31
32
|
const faster = await ensureFaster();
|
|
32
|
-
return faster.
|
|
33
|
+
return faster.swcLoader;
|
|
34
|
+
}
|
|
35
|
+
async function importGetSwcLoaderOptions() {
|
|
36
|
+
const faster = await ensureFaster();
|
|
37
|
+
return faster.getSwcLoaderOptions;
|
|
33
38
|
}
|
|
34
39
|
async function importSwcJsMinimizerOptions() {
|
|
35
40
|
const faster = await ensureFaster();
|
|
@@ -39,9 +44,9 @@ async function importSwcHtmlMinifier() {
|
|
|
39
44
|
const faster = await ensureFaster();
|
|
40
45
|
return faster.getSwcHtmlMinifier();
|
|
41
46
|
}
|
|
42
|
-
async function
|
|
47
|
+
async function importGetBrowserslistQueries() {
|
|
43
48
|
const faster = await ensureFaster();
|
|
44
|
-
return faster.getBrowserslistQueries
|
|
49
|
+
return faster.getBrowserslistQueries;
|
|
45
50
|
}
|
|
46
51
|
async function importLightningCssMinimizerOptions() {
|
|
47
52
|
const faster = await ensureFaster();
|
package/lib/importFaster.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importFaster.js","sourceRoot":"","sources":["../src/importFaster.ts"],"names":[],"mappings":";AAA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AAC,sBAAsB,CAAC;AACvC,CAAC;AAEM,KAAK,UAAU,kCAAkC;IAGtD,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;IACpC,OAAO,MAAM,CAAC,+BAA+B,EAAwC,CAAC;AACxF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/jsLoader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAC,qBAAqB,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"jsLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/jsLoader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAC,qBAAqB,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AA0C/E,wBAAsB,qBAAqB,CAAC,EAC1C,UAAU,GACX,EAAE;IACD,UAAU,EAAE;QACV,OAAO,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACtC,MAAM,EAAE;YACN,mBAAmB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,CAAC;SACxE,CAAC;KACH,CAAC;CACH,GAAG,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CA+BhD"}
|
package/lib/loaders/jsLoader.js
CHANGED
|
@@ -16,24 +16,27 @@ const BabelJsLoaderFactory = ({ isServer, babelOptions, }) => {
|
|
|
16
16
|
options: (0, babel_1.getBabelOptions)({ isServer, babelOptions }),
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
transform: {
|
|
29
|
-
react: {
|
|
30
|
-
runtime: 'automatic',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
19
|
+
async function createSwcLoaderFactory() {
|
|
20
|
+
const loader = await (0, importFaster_1.importSwcLoader)();
|
|
21
|
+
const getOptions = await (0, importFaster_1.importGetSwcLoaderOptions)();
|
|
22
|
+
return ({ isServer }) => {
|
|
23
|
+
return {
|
|
24
|
+
loader,
|
|
25
|
+
options: getOptions({ isServer }),
|
|
26
|
+
};
|
|
35
27
|
};
|
|
36
|
-
}
|
|
28
|
+
}
|
|
29
|
+
// Same as swcLoader, except we use the built-in SWC loader
|
|
30
|
+
async function createRspackLoaderFactory() {
|
|
31
|
+
const loader = 'builtin:swc-loader';
|
|
32
|
+
const getOptions = await (0, importFaster_1.importGetSwcLoaderOptions)();
|
|
33
|
+
return ({ isServer }) => {
|
|
34
|
+
return {
|
|
35
|
+
loader,
|
|
36
|
+
options: getOptions({ isServer }),
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}
|
|
37
40
|
// Confusing: function that creates a function that creates actual js loaders
|
|
38
41
|
// This is done on purpose because the js loader factory is a public API
|
|
39
42
|
// It is injected in configureWebpack plugin lifecycle for plugin authors
|
|
@@ -44,7 +47,7 @@ async function createJsLoaderFactory({ siteConfig, }) {
|
|
|
44
47
|
if (!isSWCLoader) {
|
|
45
48
|
throw new Error('When using Rspack bundler, it is required to enable swcJsLoader too');
|
|
46
49
|
}
|
|
47
|
-
return
|
|
50
|
+
return createRspackLoaderFactory();
|
|
48
51
|
}
|
|
49
52
|
const jsLoader = siteConfig.webpack?.jsLoader ?? 'babel';
|
|
50
53
|
if (jsLoader instanceof Function &&
|
|
@@ -55,7 +58,7 @@ async function createJsLoaderFactory({ siteConfig, }) {
|
|
|
55
58
|
return ({ isServer }) => jsLoader(isServer);
|
|
56
59
|
}
|
|
57
60
|
if (siteConfig.future?.experimental_faster.swcJsLoader) {
|
|
58
|
-
return (
|
|
61
|
+
return createSwcLoaderFactory();
|
|
59
62
|
}
|
|
60
63
|
if (jsLoader === 'babel') {
|
|
61
64
|
return BabelJsLoaderFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsLoader.js","sourceRoot":"","sources":["../../src/loaders/jsLoader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;
|
|
1
|
+
{"version":3,"file":"jsLoader.js","sourceRoot":"","sources":["../../src/loaders/jsLoader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA+CH,sDAwCC;AArFD,6CAAkD;AAClD,kDAA2E;AAC3E,sDAAoD;AAGpD,MAAM,oBAAoB,GAAyC,CAAC,EAClE,QAAQ,EACR,YAAY,GACb,EAAE,EAAE;IACH,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;QACvC,OAAO,EAAE,IAAA,uBAAe,EAAC,EAAC,QAAQ,EAAE,YAAY,EAAC,CAAC;KACnD,CAAC;AACJ,CAAC,CAAC;AAEF,KAAK,UAAU,sBAAsB;IAGnC,MAAM,MAAM,GAAG,MAAM,IAAA,8BAAe,GAAE,CAAC;IACvC,MAAM,UAAU,GAAG,MAAM,IAAA,wCAAyB,GAAE,CAAC;IACrD,OAAO,CAAC,EAAC,QAAQ,EAAC,EAAE,EAAE;QACpB,OAAO;YACL,MAAM;YACN,OAAO,EAAE,UAAU,CAAC,EAAC,QAAQ,EAAC,CAAC;SAChC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,2DAA2D;AAC3D,KAAK,UAAU,yBAAyB;IAGtC,MAAM,MAAM,GAAG,oBAAoB,CAAC;IACpC,MAAM,UAAU,GAAG,MAAM,IAAA,wCAAyB,GAAE,CAAC;IACrD,OAAO,CAAC,EAAC,QAAQ,EAAC,EAAE,EAAE;QACpB,OAAO;YACL,MAAM;YACN,OAAO,EAAE,UAAU,CAAC,EAAC,QAAQ,EAAC,CAAC;SAChC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,wEAAwE;AACxE,yEAAyE;AAClE,KAAK,UAAU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,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,gBAAgB,GAAG,uBAAuB,CAAC,CAAC;IACvE,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;
|
|
1
|
+
{"version":3,"file":"minification.d.ts","sourceRoot":"","sources":["../src/minification.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,gBAAgB,GAAG,uBAAuB,CAAC,CAAC;IACvE,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAmJF,wBAAsB,aAAa,CACjC,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAIlC"}
|
package/lib/minification.js
CHANGED
|
@@ -114,7 +114,8 @@ async function getWebpackMinimizers(params) {
|
|
|
114
114
|
}
|
|
115
115
|
async function getRspackMinimizers({ currentBundler, }) {
|
|
116
116
|
const rspack = (0, currentBundler_1.getCurrentBundlerAsRspack)({ currentBundler });
|
|
117
|
-
const
|
|
117
|
+
const getBrowserslistQueries = await (0, importFaster_1.importGetBrowserslistQueries)();
|
|
118
|
+
const browserslistQueries = getBrowserslistQueries({ isServer: false });
|
|
118
119
|
const swcJsMinimizerOptions = await (0, importFaster_1.importSwcJsMinimizerOptions)();
|
|
119
120
|
return [
|
|
120
121
|
// See https://rspack.dev/plugins/rspack/swc-js-minimizer-rspack-plugin
|
package/lib/minification.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minification.js","sourceRoot":"","sources":["../src/minification.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;
|
|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"0.0.0-
|
|
3
|
+
"version": "0.0.0-6115",
|
|
4
4
|
"description": "Docusaurus util package to abstract the current bundler.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@babel/core": "^7.23.3",
|
|
22
|
-
"@docusaurus/babel": "0.0.0-
|
|
23
|
-
"@docusaurus/cssnano-preset": "0.0.0-
|
|
24
|
-
"@docusaurus/logger": "0.0.0-
|
|
25
|
-
"@docusaurus/types": "0.0.0-
|
|
26
|
-
"@docusaurus/utils": "0.0.0-
|
|
22
|
+
"@docusaurus/babel": "0.0.0-6115",
|
|
23
|
+
"@docusaurus/cssnano-preset": "0.0.0-6115",
|
|
24
|
+
"@docusaurus/logger": "0.0.0-6115",
|
|
25
|
+
"@docusaurus/types": "0.0.0-6115",
|
|
26
|
+
"@docusaurus/utils": "0.0.0-6115",
|
|
27
27
|
"autoprefixer": "^10.4.14",
|
|
28
28
|
"babel-loader": "^9.1.3",
|
|
29
29
|
"clean-css": "^5.3.2",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=18.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "6ce8454eb6aa13b24a5c5f9a95cbb0bf4a177bd7"
|
|
62
62
|
}
|
package/src/importFaster.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {ConfigureWebpackUtils} from '@docusaurus/types';
|
|
9
8
|
import type {
|
|
10
9
|
MinimizerOptions as JsMinimizerOptions,
|
|
11
10
|
CustomOptions,
|
|
@@ -34,11 +33,16 @@ export async function importRspack(): Promise<FasterModule['rspack']> {
|
|
|
34
33
|
return faster.rspack;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
export async function
|
|
38
|
-
|
|
36
|
+
export async function importSwcLoader(): Promise<string> {
|
|
37
|
+
const faster = await ensureFaster();
|
|
38
|
+
return faster.swcLoader;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function importGetSwcLoaderOptions(): Promise<
|
|
42
|
+
FasterModule['getSwcLoaderOptions']
|
|
39
43
|
> {
|
|
40
44
|
const faster = await ensureFaster();
|
|
41
|
-
return faster.
|
|
45
|
+
return faster.getSwcLoaderOptions;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
export async function importSwcJsMinimizerOptions(): Promise<
|
|
@@ -55,9 +59,11 @@ export async function importSwcHtmlMinifier(): Promise<
|
|
|
55
59
|
return faster.getSwcHtmlMinifier();
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
export async function
|
|
62
|
+
export async function importGetBrowserslistQueries(): Promise<
|
|
63
|
+
FasterModule['getBrowserslistQueries']
|
|
64
|
+
> {
|
|
59
65
|
const faster = await ensureFaster();
|
|
60
|
-
return faster.getBrowserslistQueries
|
|
66
|
+
return faster.getBrowserslistQueries;
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
export async function importLightningCssMinimizerOptions(): Promise<
|
package/src/loaders/jsLoader.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import {getBabelOptions} from '@docusaurus/babel';
|
|
9
|
-
import {
|
|
9
|
+
import {importSwcLoader, importGetSwcLoaderOptions} from '../importFaster';
|
|
10
10
|
import {getCurrentBundler} from '../currentBundler';
|
|
11
11
|
import type {ConfigureWebpackUtils, DocusaurusConfig} from '@docusaurus/types';
|
|
12
12
|
|
|
@@ -20,24 +20,32 @@ const BabelJsLoaderFactory: ConfigureWebpackUtils['getJSLoader'] = ({
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
react: {
|
|
34
|
-
runtime: 'automatic',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
23
|
+
async function createSwcLoaderFactory(): Promise<
|
|
24
|
+
ConfigureWebpackUtils['getJSLoader']
|
|
25
|
+
> {
|
|
26
|
+
const loader = await importSwcLoader();
|
|
27
|
+
const getOptions = await importGetSwcLoaderOptions();
|
|
28
|
+
return ({isServer}) => {
|
|
29
|
+
return {
|
|
30
|
+
loader,
|
|
31
|
+
options: getOptions({isServer}),
|
|
32
|
+
};
|
|
39
33
|
};
|
|
40
|
-
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Same as swcLoader, except we use the built-in SWC loader
|
|
37
|
+
async function createRspackLoaderFactory(): Promise<
|
|
38
|
+
ConfigureWebpackUtils['getJSLoader']
|
|
39
|
+
> {
|
|
40
|
+
const loader = 'builtin:swc-loader';
|
|
41
|
+
const getOptions = await importGetSwcLoaderOptions();
|
|
42
|
+
return ({isServer}) => {
|
|
43
|
+
return {
|
|
44
|
+
loader,
|
|
45
|
+
options: getOptions({isServer}),
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
}
|
|
41
49
|
|
|
42
50
|
// Confusing: function that creates a function that creates actual js loaders
|
|
43
51
|
// This is done on purpose because the js loader factory is a public API
|
|
@@ -61,7 +69,7 @@ export async function createJsLoaderFactory({
|
|
|
61
69
|
'When using Rspack bundler, it is required to enable swcJsLoader too',
|
|
62
70
|
);
|
|
63
71
|
}
|
|
64
|
-
return
|
|
72
|
+
return createRspackLoaderFactory();
|
|
65
73
|
}
|
|
66
74
|
const jsLoader = siteConfig.webpack?.jsLoader ?? 'babel';
|
|
67
75
|
if (
|
|
@@ -76,7 +84,7 @@ export async function createJsLoaderFactory({
|
|
|
76
84
|
return ({isServer}) => jsLoader(isServer);
|
|
77
85
|
}
|
|
78
86
|
if (siteConfig.future?.experimental_faster.swcJsLoader) {
|
|
79
|
-
return
|
|
87
|
+
return createSwcLoaderFactory();
|
|
80
88
|
}
|
|
81
89
|
if (jsLoader === 'babel') {
|
|
82
90
|
return BabelJsLoaderFactory;
|
package/src/minification.ts
CHANGED
|
@@ -10,7 +10,7 @@ import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
|
10
10
|
import {
|
|
11
11
|
importSwcJsMinimizerOptions,
|
|
12
12
|
importLightningCssMinimizerOptions,
|
|
13
|
-
|
|
13
|
+
importGetBrowserslistQueries,
|
|
14
14
|
} from './importFaster';
|
|
15
15
|
import {getCurrentBundlerAsRspack} from './currentBundler';
|
|
16
16
|
import type {CustomOptions, CssNanoOptions} from 'css-minimizer-webpack-plugin';
|
|
@@ -141,7 +141,8 @@ async function getRspackMinimizers({
|
|
|
141
141
|
currentBundler,
|
|
142
142
|
}: MinimizersConfig): Promise<WebpackPluginInstance[]> {
|
|
143
143
|
const rspack = getCurrentBundlerAsRspack({currentBundler});
|
|
144
|
-
const
|
|
144
|
+
const getBrowserslistQueries = await importGetBrowserslistQueries();
|
|
145
|
+
const browserslistQueries = getBrowserslistQueries({isServer: false});
|
|
145
146
|
const swcJsMinimizerOptions = await importSwcJsMinimizerOptions();
|
|
146
147
|
return [
|
|
147
148
|
// See https://rspack.dev/plugins/rspack/swc-js-minimizer-rspack-plugin
|