@docusaurus/faster 0.0.0-6083 → 0.0.0-6094

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/index.d.ts CHANGED
@@ -4,10 +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 * as lightningcss from 'lightningcss';
7
8
  import type { RuleSetRule } from 'webpack';
8
9
  import type { JsMinifyOptions } from '@swc/core';
9
10
  export declare function getSwcJsLoaderFactory({ isServer, }: {
10
11
  isServer: boolean;
11
12
  }): RuleSetRule;
12
- export declare function getSwcJsMinifierOptions(): JsMinifyOptions;
13
+ export declare function getSwcJsMinimizerOptions(): JsMinifyOptions;
14
+ type LightningCssMinimizerOptions = Omit<lightningcss.TransformOptions<never>, 'filename' | 'code'>;
15
+ export declare function getLightningCssMinimizerOptions(): LightningCssMinimizerOptions;
16
+ export {};
13
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,WAAW,CAAC;AAE/C,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC;CACnB,GAAG,WAAW,CAqBd;AAMD,wBAAgB,uBAAuB,IAAI,eAAe,CAezD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,YAAY,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,WAAW,CAAC;AAE/C,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC;CACnB,GAAG,WAAW,CAqBd;AAMD,wBAAgB,wBAAwB,IAAI,eAAe,CAe1D;AAKD,KAAK,4BAA4B,GAAG,IAAI,CACtC,YAAY,CAAC,gBAAgB,CAAC,KAAK,CAAC,EACpC,UAAU,GAAG,MAAM,CACpB,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,4BAA4B,CAG9E"}
package/lib/index.js CHANGED
@@ -7,7 +7,11 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.getSwcJsLoaderFactory = getSwcJsLoaderFactory;
10
- exports.getSwcJsMinifierOptions = getSwcJsMinifierOptions;
10
+ exports.getSwcJsMinimizerOptions = getSwcJsMinimizerOptions;
11
+ exports.getLightningCssMinimizerOptions = getLightningCssMinimizerOptions;
12
+ const tslib_1 = require("tslib");
13
+ const lightningcss = tslib_1.__importStar(require("lightningcss"));
14
+ const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
11
15
  function getSwcJsLoaderFactory({ isServer, }) {
12
16
  return {
13
17
  loader: require.resolve('swc-loader'),
@@ -34,7 +38,7 @@ function getSwcJsLoaderFactory({ isServer, }) {
34
38
  // They should rather be kept in sync for now to avoid any unexpected behavior
35
39
  // The goal of faster minifier is not to fine-tune options but only to be faster
36
40
  // See core minification.ts
37
- function getSwcJsMinifierOptions() {
41
+ function getSwcJsMinimizerOptions() {
38
42
  return {
39
43
  ecma: 2020,
40
44
  compress: {
@@ -50,4 +54,8 @@ function getSwcJsMinifierOptions() {
50
54
  },
51
55
  };
52
56
  }
57
+ function getLightningCssMinimizerOptions() {
58
+ const queries = (0, browserslist_1.default)();
59
+ return { targets: lightningcss.browserslistToTargets(queries) };
60
+ }
53
61
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;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ACT,KAAK,EAAE;wBACL,OAAO,EAAE,WAAW;qBACrB;iBACF;gBACD,MAAM,EAAE,QAAQ;aACjB;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK;aACpC;SACF;KACF,CAAC;AACJ,CAAC;AAED,yDAAyD;AACzD,8EAA8E;AAC9E,gFAAgF;AAChF,2BAA2B;AAC3B,SAAgB,wBAAwB;IACtC,OAAO;QACL,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE;YACR,IAAI,EAAE,CAAC;SACR;QACD,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;AACJ,CAAC;AAUD,SAAgB,+BAA+B;IAC7C,MAAM,OAAO,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC/B,OAAO,EAAC,OAAO,EAAE,YAAY,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAC,CAAC;AAChE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/faster",
3
- "version": "0.0.0-6083",
3
+ "version": "0.0.0-6094",
4
4
  "description": "Docusaurus experimental package exposing new modern dependencies to make the build faster.",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -19,6 +19,8 @@
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
21
  "@swc/core": "^1.7.14",
22
+ "browserslist": "^4.24.0",
23
+ "lightningcss": "^1.27.0",
22
24
  "swc-loader": "^0.2.6",
23
25
  "webpack": "^5.88.1"
24
26
  },
@@ -28,5 +30,5 @@
28
30
  "peerDependencies": {
29
31
  "@docusaurus/types": "*"
30
32
  },
31
- "gitHead": "474967f4f49da90a1fca9f9034b0c054c5e29c7f"
33
+ "gitHead": "c2b31a8be6d238545a078faac4ee39b1b0e9d20c"
32
34
  }
package/src/index.ts CHANGED
@@ -5,6 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ import * as lightningcss from 'lightningcss';
9
+ import browserslist from 'browserslist';
8
10
  import type {RuleSetRule} from 'webpack';
9
11
  import type {JsMinifyOptions} from '@swc/core';
10
12
 
@@ -39,7 +41,7 @@ export function getSwcJsLoaderFactory({
39
41
  // They should rather be kept in sync for now to avoid any unexpected behavior
40
42
  // The goal of faster minifier is not to fine-tune options but only to be faster
41
43
  // See core minification.ts
42
- export function getSwcJsMinifierOptions(): JsMinifyOptions {
44
+ export function getSwcJsMinimizerOptions(): JsMinifyOptions {
43
45
  return {
44
46
  ecma: 2020,
45
47
  compress: {
@@ -55,3 +57,16 @@ export function getSwcJsMinifierOptions(): JsMinifyOptions {
55
57
  },
56
58
  };
57
59
  }
60
+
61
+ // LightningCSS doesn't expose any type for css-minimizer-webpack-plugin setup
62
+ // So we derive it ourselves
63
+ // see https://lightningcss.dev/docs.html#with-webpack
64
+ type LightningCssMinimizerOptions = Omit<
65
+ lightningcss.TransformOptions<never>,
66
+ 'filename' | 'code'
67
+ >;
68
+
69
+ export function getLightningCssMinimizerOptions(): LightningCssMinimizerOptions {
70
+ const queries = browserslist();
71
+ return {targets: lightningcss.browserslistToTargets(queries)};
72
+ }