@docusaurus/faster 0.0.0-6054 → 0.0.0-6055

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
@@ -5,7 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { RuleSetRule } from 'webpack';
8
+ import type { JsMinifyOptions } from '@swc/core';
8
9
  export declare function getSwcJsLoaderFactory({ isServer, }: {
9
10
  isServer: boolean;
10
11
  }): RuleSetRule;
12
+ export declare function getSwcJsMinifierOptions(): JsMinifyOptions;
11
13
  //# 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;AAEzC,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC;CACnB,GAAG,WAAW,CAqBd"}
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"}
package/lib/index.js CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.getSwcJsLoaderFactory = getSwcJsLoaderFactory;
10
+ exports.getSwcJsMinifierOptions = getSwcJsMinifierOptions;
10
11
  function getSwcJsLoaderFactory({ isServer, }) {
11
12
  return {
12
13
  loader: require.resolve('swc-loader'),
@@ -29,4 +30,24 @@ function getSwcJsLoaderFactory({ isServer, }) {
29
30
  },
30
31
  };
31
32
  }
33
+ // Note: these options are similar to what we use in core
34
+ // They should rather be kept in sync for now to avoid any unexpected behavior
35
+ // The goal of faster minifier is not to fine-tune options but only to be faster
36
+ // See core minification.ts
37
+ function getSwcJsMinifierOptions() {
38
+ return {
39
+ ecma: 2020,
40
+ compress: {
41
+ ecma: 5,
42
+ },
43
+ module: true,
44
+ mangle: true,
45
+ safari10: true,
46
+ format: {
47
+ ecma: 5,
48
+ comments: false,
49
+ ascii_only: true,
50
+ },
51
+ };
52
+ }
32
53
  //# 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;;;;;GAKG;;AAIH,sDAyBC;AAzBD,SAAgB,qBAAqB,CAAC,EACpC,QAAQ,GAGT;IACC,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;QACrC,OAAO,EAAE;YACP,GAAG,EAAE;gBACH,MAAM,EAAE;oBACN,MAAM,EAAE,YAAY;oBACpB,GAAG,EAAE,IAAI;iBACV;gBACD,SAAS,EAAE;oBACT,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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAKH,sDAyBC;AAMD,0DAeC;AA9CD,SAAgB,qBAAqB,CAAC,EACpC,QAAQ,GAGT;IACC,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;QACrC,OAAO,EAAE;YACP,GAAG,EAAE;gBACH,MAAM,EAAE;oBACN,MAAM,EAAE,YAAY;oBACpB,GAAG,EAAE,IAAI;iBACV;gBACD,SAAS,EAAE;oBACT,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,uBAAuB;IACrC,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/faster",
3
- "version": "0.0.0-6054",
3
+ "version": "0.0.0-6055",
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",
@@ -28,5 +28,5 @@
28
28
  "peerDependencies": {
29
29
  "@docusaurus/types": "*"
30
30
  },
31
- "gitHead": "0103d6a736d41bc0ef05238adf860b12476fa106"
31
+ "gitHead": "b57b82e42ebabf1864ac745b95199ff62fb289af"
32
32
  }
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import type {RuleSetRule} from 'webpack';
9
+ import type {JsMinifyOptions} from '@swc/core';
9
10
 
10
11
  export function getSwcJsLoaderFactory({
11
12
  isServer,
@@ -33,3 +34,24 @@ export function getSwcJsLoaderFactory({
33
34
  },
34
35
  };
35
36
  }
37
+
38
+ // Note: these options are similar to what we use in core
39
+ // They should rather be kept in sync for now to avoid any unexpected behavior
40
+ // The goal of faster minifier is not to fine-tune options but only to be faster
41
+ // See core minification.ts
42
+ export function getSwcJsMinifierOptions(): JsMinifyOptions {
43
+ return {
44
+ ecma: 2020,
45
+ compress: {
46
+ ecma: 5,
47
+ },
48
+ module: true,
49
+ mangle: true,
50
+ safari10: true,
51
+ format: {
52
+ ecma: 5,
53
+ comments: false,
54
+ ascii_only: true,
55
+ },
56
+ };
57
+ }