@bleedingdev/modern-js-builder 3.2.0-ultramodern.119 → 3.2.0-ultramodern.120

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.
@@ -43,6 +43,7 @@ const globalVars_js_namespaceObject = require("../plugins/globalVars.js");
43
43
  const htmlMinify_js_namespaceObject = require("../plugins/htmlMinify.js");
44
44
  const runtimeChunk_js_namespaceObject = require("../plugins/runtimeChunk.js");
45
45
  const external_devServer_js_namespaceObject = require("./devServer.js");
46
+ const external_tsgo_js_namespaceObject = require("./tsgo.js");
46
47
  const external_utils_js_namespaceObject = require("./utils.js");
47
48
  const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
48
49
  const GLOBAL_CSS_REGEX = /\.global\.\w+$/;
@@ -156,7 +157,7 @@ async function parseCommonConfig(builderConfig, options) {
156
157
  if (!disableTsChecker) {
157
158
  const { pluginTypeCheck } = await import("@rsbuild/plugin-type-check");
158
159
  rsbuildPlugins.push(pluginTypeCheck({
159
- tsCheckerOptions: tsChecker
160
+ tsCheckerOptions: (0, external_tsgo_js_namespaceObject.withTsgoDefaults)(tsChecker, options?.cwd ?? process.cwd())
160
161
  }));
161
162
  }
162
163
  if (convertToRem) {
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
+ return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
+ }();
5
+ var __webpack_require__ = {};
6
+ (()=>{
7
+ __webpack_require__.d = (exports1, getters, values)=>{
8
+ var define = (defs, kind)=>{
9
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
10
+ enumerable: true,
11
+ [kind]: defs[key]
12
+ });
13
+ };
14
+ define(getters, "get");
15
+ define(values, "value");
16
+ };
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
20
+ })();
21
+ (()=>{
22
+ __webpack_require__.r = (exports1)=>{
23
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
24
+ value: 'Module'
25
+ });
26
+ Object.defineProperty(exports1, '__esModule', {
27
+ value: true
28
+ });
29
+ };
30
+ })();
31
+ var __webpack_exports__ = {};
32
+ __webpack_require__.r(__webpack_exports__);
33
+ __webpack_require__.d(__webpack_exports__, {
34
+ withTsgoDefaults: ()=>withTsgoDefaults
35
+ });
36
+ const external_node_module_namespaceObject = require("node:module");
37
+ const builderRequire = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
38
+ const TSGO_PACKAGE = "@typescript/native-preview/package.json";
39
+ const tryResolve = (request, rootPath)=>{
40
+ try {
41
+ return builderRequire.resolve(request, {
42
+ paths: [
43
+ rootPath
44
+ ]
45
+ });
46
+ } catch {
47
+ return;
48
+ }
49
+ };
50
+ const withTsgoDefaults = (userOptions, rootPath)=>{
51
+ const tsgoPath = tryResolve(TSGO_PACKAGE, rootPath) ?? builderRequire.resolve(TSGO_PACKAGE);
52
+ const userChain = userOptions ? Array.isArray(userOptions) ? userOptions : [
53
+ userOptions
54
+ ] : [];
55
+ return [
56
+ {
57
+ typescript: {
58
+ tsgo: true,
59
+ typescriptPath: tsgoPath
60
+ }
61
+ },
62
+ ...userChain,
63
+ (config)=>{
64
+ const { typescript } = config;
65
+ if (typescript?.tsgo === false && typescript.typescriptPath === tsgoPath) typescript.typescriptPath = tryResolve("typescript", rootPath);
66
+ return config;
67
+ }
68
+ ];
69
+ };
70
+ exports.withTsgoDefaults = __webpack_exports__.withTsgoDefaults;
71
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
72
+ "withTsgoDefaults"
73
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
74
+ Object.defineProperty(exports, '__esModule', {
75
+ value: true
76
+ });
@@ -10,6 +10,7 @@ import { pluginGlobalVars } from "../plugins/globalVars.mjs";
10
10
  import { pluginHtmlMinifierTerser } from "../plugins/htmlMinify.mjs";
11
11
  import { pluginRuntimeChunk } from "../plugins/runtimeChunk.mjs";
12
12
  import { transformToRsbuildServerOptions } from "./devServer.mjs";
13
+ import { withTsgoDefaults } from "./tsgo.mjs";
13
14
  import { NODE_MODULES_REGEX } from "./utils.mjs";
14
15
  const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
15
16
  const GLOBAL_CSS_REGEX = /\.global\.\w+$/;
@@ -123,7 +124,7 @@ async function parseCommonConfig(builderConfig, options) {
123
124
  if (!disableTsChecker) {
124
125
  const { pluginTypeCheck } = await import("@rsbuild/plugin-type-check");
125
126
  rsbuildPlugins.push(pluginTypeCheck({
126
- tsCheckerOptions: tsChecker
127
+ tsCheckerOptions: withTsgoDefaults(tsChecker, options?.cwd ?? process.cwd())
127
128
  }));
128
129
  }
129
130
  if (convertToRem) {
@@ -0,0 +1,35 @@
1
+ import { createRequire } from "node:module";
2
+ const builderRequire = createRequire(import.meta.url);
3
+ const TSGO_PACKAGE = "@typescript/native-preview/package.json";
4
+ const tryResolve = (request, rootPath)=>{
5
+ try {
6
+ return builderRequire.resolve(request, {
7
+ paths: [
8
+ rootPath
9
+ ]
10
+ });
11
+ } catch {
12
+ return;
13
+ }
14
+ };
15
+ const withTsgoDefaults = (userOptions, rootPath)=>{
16
+ const tsgoPath = tryResolve(TSGO_PACKAGE, rootPath) ?? builderRequire.resolve(TSGO_PACKAGE);
17
+ const userChain = userOptions ? Array.isArray(userOptions) ? userOptions : [
18
+ userOptions
19
+ ] : [];
20
+ return [
21
+ {
22
+ typescript: {
23
+ tsgo: true,
24
+ typescriptPath: tsgoPath
25
+ }
26
+ },
27
+ ...userChain,
28
+ (config)=>{
29
+ const { typescript } = config;
30
+ if (typescript?.tsgo === false && typescript.typescriptPath === tsgoPath) typescript.typescriptPath = tryResolve("typescript", rootPath);
31
+ return config;
32
+ }
33
+ ];
34
+ };
35
+ export { withTsgoDefaults };
@@ -11,6 +11,7 @@ import { pluginGlobalVars } from "../plugins/globalVars.mjs";
11
11
  import { pluginHtmlMinifierTerser } from "../plugins/htmlMinify.mjs";
12
12
  import { pluginRuntimeChunk } from "../plugins/runtimeChunk.mjs";
13
13
  import { transformToRsbuildServerOptions } from "./devServer.mjs";
14
+ import { withTsgoDefaults } from "./tsgo.mjs";
14
15
  import { NODE_MODULES_REGEX } from "./utils.mjs";
15
16
  const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
16
17
  const GLOBAL_CSS_REGEX = /\.global\.\w+$/;
@@ -124,7 +125,7 @@ async function parseCommonConfig(builderConfig, options) {
124
125
  if (!disableTsChecker) {
125
126
  const { pluginTypeCheck } = await import("@rsbuild/plugin-type-check");
126
127
  rsbuildPlugins.push(pluginTypeCheck({
127
- tsCheckerOptions: tsChecker
128
+ tsCheckerOptions: withTsgoDefaults(tsChecker, options?.cwd ?? process.cwd())
128
129
  }));
129
130
  }
130
131
  if (convertToRem) {
@@ -0,0 +1,36 @@
1
+ import "node:module";
2
+ import { createRequire } from "node:module";
3
+ const builderRequire = createRequire(import.meta.url);
4
+ const TSGO_PACKAGE = "@typescript/native-preview/package.json";
5
+ const tryResolve = (request, rootPath)=>{
6
+ try {
7
+ return builderRequire.resolve(request, {
8
+ paths: [
9
+ rootPath
10
+ ]
11
+ });
12
+ } catch {
13
+ return;
14
+ }
15
+ };
16
+ const withTsgoDefaults = (userOptions, rootPath)=>{
17
+ const tsgoPath = tryResolve(TSGO_PACKAGE, rootPath) ?? builderRequire.resolve(TSGO_PACKAGE);
18
+ const userChain = userOptions ? Array.isArray(userOptions) ? userOptions : [
19
+ userOptions
20
+ ] : [];
21
+ return [
22
+ {
23
+ typescript: {
24
+ tsgo: true,
25
+ typescriptPath: tsgoPath
26
+ }
27
+ },
28
+ ...userChain,
29
+ (config)=>{
30
+ const { typescript } = config;
31
+ if (typescript?.tsgo === false && typescript.typescriptPath === tsgoPath) typescript.typescriptPath = tryResolve("typescript", rootPath);
32
+ return config;
33
+ }
34
+ ];
35
+ };
36
+ export { withTsgoDefaults };
@@ -0,0 +1,12 @@
1
+ import type { PluginTypeCheckerOptions } from '@rsbuild/plugin-type-check';
2
+ type TsCheckerChain = NonNullable<PluginTypeCheckerOptions['tsCheckerOptions']>;
3
+ type TsCheckerFn = Extract<TsCheckerChain, (config: never) => unknown>;
4
+ export type TsCheckerOptions = Parameters<TsCheckerFn>[0];
5
+ /**
6
+ * Type checking runs on TypeScript Go (`tsgo`) by default. The checker
7
+ * prefers the project's own `@typescript/native-preview` and falls back to
8
+ * the copy bundled with the builder, so it works without an extra install.
9
+ * Set `tools.tsChecker.typescript.tsgo: false` to use the classic checker.
10
+ */
11
+ export declare const withTsgoDefaults: (userOptions: TsCheckerChain | undefined, rootPath: string) => TsCheckerChain;
12
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bleedingdev/modern-js-builder",
3
- "version": "3.2.0-ultramodern.119",
3
+ "version": "3.2.0-ultramodern.120",
4
4
  "description": "A builder for Modern.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "dist"
27
27
  ],
28
28
  "dependencies": {
29
- "@rsbuild/core": "2.0.10",
29
+ "@rsbuild/core": "2.0.11",
30
30
  "@rsbuild/plugin-assets-retry": "2.0.1",
31
31
  "@rsbuild/plugin-check-syntax": "2.0.0",
32
32
  "@rsbuild/plugin-css-minimizer": "2.0.1",
@@ -36,10 +36,11 @@
36
36
  "@rsbuild/plugin-sass": "1.5.3",
37
37
  "@rsbuild/plugin-source-build": "1.0.6",
38
38
  "@rsbuild/plugin-svgr": "2.0.3",
39
- "@rsbuild/plugin-type-check": "1.3.5",
40
- "@rsbuild/plugin-typed-css-modules": "1.2.3",
39
+ "@rsbuild/plugin-type-check": "1.4.0",
40
+ "@rsbuild/plugin-typed-css-modules": "1.2.4",
41
41
  "@rsdoctor/rspack-plugin": "^1.5.12",
42
- "@swc/core": "1.15.40",
42
+ "@typescript/native-preview": "7.0.0-dev.20260610.1",
43
+ "@swc/core": "1.15.41",
43
44
  "@swc/helpers": "^0.5.23",
44
45
  "autoprefixer": "10.5.0",
45
46
  "browserslist": "4.28.2",
@@ -57,18 +58,17 @@
57
58
  "postcss-nesting": "14.0.0",
58
59
  "postcss-page-break": "3.0.4",
59
60
  "rsbuild-plugin-rsc": "0.1.0",
60
- "rspack-manifest-plugin": "5.2.1",
61
+ "rspack-manifest-plugin": "5.2.2",
61
62
  "ts-deepmerge": "8.0.0",
62
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.119"
63
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.120"
63
64
  },
64
65
  "devDependencies": {
65
- "@rslib/core": "0.21.5",
66
+ "@rslib/core": "0.22.0",
66
67
  "@types/html-minifier-terser": "^7.0.2",
67
68
  "@types/lodash": "^4.17.24",
68
- "@typescript/native-preview": "7.0.0-dev.20260606.1",
69
69
  "react": "^19.2.7",
70
70
  "terser": "^5.48.0",
71
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.119",
71
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.120",
72
72
  "@scripts/rstest-config": "2.66.0"
73
73
  },
74
74
  "publishConfig": {