@simplysm/sd-cli 10.0.39 → 10.0.45

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.
Files changed (66) hide show
  1. package/dist/build-tools/SdCliIndexFileGenerator.d.ts +5 -0
  2. package/dist/build-tools/SdCliIndexFileGenerator.js +51 -0
  3. package/dist/build-tools/SdCliIndexFileGenerator.js.map +1 -0
  4. package/dist/{SdLinter.d.ts → build-tools/SdLinter.d.ts} +1 -1
  5. package/dist/{SdLinter.js → build-tools/SdLinter.js} +2 -1
  6. package/dist/build-tools/SdLinter.js.map +1 -0
  7. package/dist/{SdTsIncrementalBuilder.d.ts → build-tools/SdTsIncrementalBuilder.d.ts} +1 -1
  8. package/dist/{SdTsIncrementalBuilder.js → build-tools/SdTsIncrementalBuilder.js} +1 -1
  9. package/dist/build-tools/SdTsIncrementalBuilder.js.map +1 -0
  10. package/dist/builders/SdCliClientBuilder.js +84 -8
  11. package/dist/builders/SdCliClientBuilder.js.map +1 -1
  12. package/dist/builders/SdCliJsLibLinter.js +1 -1
  13. package/dist/builders/SdCliJsLibLinter.js.map +1 -1
  14. package/dist/builders/SdCliServerBuilder.js +22 -5
  15. package/dist/builders/SdCliServerBuilder.js.map +1 -1
  16. package/dist/builders/SdCliTsLibBuilder.js +6 -5
  17. package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
  18. package/dist/commons.d.ts +18 -7
  19. package/dist/entry/SdCliElectron.d.ts +5 -0
  20. package/dist/entry/SdCliElectron.js +59 -1
  21. package/dist/entry/SdCliElectron.js.map +1 -1
  22. package/dist/entry/SdCliProject.js +75 -14
  23. package/dist/entry/SdCliProject.js.map +1 -1
  24. package/dist/index.d.ts +19 -1
  25. package/dist/index.js +19 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/sd-cli.js +26 -21
  28. package/dist/sd-cli.js.map +1 -1
  29. package/dist/utils/SdCliBuildResultUtil.js +3 -2
  30. package/dist/utils/SdCliBuildResultUtil.js.map +1 -1
  31. package/dist/utils/SdCliViteElectronMainPlugin.js +24 -7
  32. package/dist/utils/SdCliViteElectronMainPlugin.js.map +1 -1
  33. package/dist/utils/SdCliViteExternalPlugin.d.ts +1 -0
  34. package/dist/utils/SdCliViteExternalPlugin.js +9 -6
  35. package/dist/utils/SdCliViteExternalPlugin.js.map +1 -1
  36. package/dist/utils/SdCliViteNodeGlobalPlugin.js +2 -2
  37. package/dist/utils/SdCliViteNodeGlobalPlugin.js.map +1 -1
  38. package/dist/utils/SdCliViteReactSwcPlugin.js +2 -4
  39. package/dist/utils/SdCliViteReactSwcPlugin.js.map +1 -1
  40. package/dist/utils/sdCliTsDefineTransformer.js.map +1 -1
  41. package/package.json +15 -14
  42. package/src/build-tools/SdCliIndexFileGenerator.ts +62 -0
  43. package/src/{SdLinter.ts → build-tools/SdLinter.ts} +3 -2
  44. package/src/{SdTsIncrementalBuilder.ts → build-tools/SdTsIncrementalBuilder.ts} +2 -2
  45. package/src/builders/SdCliClientBuilder.ts +298 -203
  46. package/src/builders/SdCliJsLibLinter.ts +1 -1
  47. package/src/builders/SdCliServerBuilder.ts +325 -307
  48. package/src/builders/SdCliTsLibBuilder.ts +135 -133
  49. package/src/commons.ts +73 -61
  50. package/src/entry/SdCliElectron.ts +124 -48
  51. package/src/entry/SdCliProject.ts +526 -451
  52. package/src/index.ts +19 -1
  53. package/src/sd-cli.ts +190 -179
  54. package/src/utils/SdCliBuildResultUtil.ts +4 -3
  55. package/src/utils/SdCliViteElectronMainPlugin.ts +25 -7
  56. package/src/utils/SdCliViteExternalPlugin.ts +12 -7
  57. package/src/utils/SdCliViteNodeGlobalPlugin.ts +5 -5
  58. package/src/utils/SdCliViteReactSwcPlugin.ts +6 -8
  59. package/src/utils/sdCliTsDefineTransformer.ts +23 -23
  60. package/tsconfig.json +7 -1
  61. package/dist/SdLinter.js.map +0 -1
  62. package/dist/SdTsIncrementalBuilder.js.map +0 -1
  63. package/dist/entry/SdCliLocalUpdate.d.ts +0 -12
  64. package/dist/entry/SdCliLocalUpdate.js +0 -94
  65. package/dist/entry/SdCliLocalUpdate.js.map +0 -1
  66. package/src/entry/SdCliLocalUpdate.ts +0 -125
package/src/index.ts CHANGED
@@ -1 +1,19 @@
1
- export { TSdCliConfigFn, ISdCliConfig } from "./commons";
1
+ export * from "./build-tools/SdCliIndexFileGenerator";
2
+ export * from "./build-tools/SdLinter";
3
+ export * from "./build-tools/SdTsIncrementalBuilder";
4
+ export * from "./builders/SdCliClientBuilder";
5
+ export * from "./builders/SdCliJsLibLinter";
6
+ export * from "./builders/SdCliServerBuilder";
7
+ export * from "./builders/SdCliTsLibBuilder";
8
+ export * from "./commons";
9
+ export * from "./entry/SdCliElectron";
10
+ export * from "./entry/SdCliProject";
11
+ export * from "./utils/getElectronReactExternals";
12
+ export * from "./utils/SdCliBuildResultUtil";
13
+ export * from "./utils/sdCliTsDefineTransformer";
14
+ export * from "./utils/SdCliViteElectronMainPlugin";
15
+ export * from "./utils/SdCliViteExternalPlugin";
16
+ export * from "./utils/SdCliViteLoggerPlugin";
17
+ export * from "./utils/SdCliViteNodeGlobalPlugin";
18
+ export * from "./utils/SdCliViteReactSwcPlugin";
19
+ export * from "./utils/SdCliViteWatchWithResolutionsPlugin";
package/src/sd-cli.ts CHANGED
@@ -6,196 +6,207 @@ import {SdCliProject} from "./entry/SdCliProject";
6
6
  import {Logger, LoggerSeverity} from "@simplysm/sd-core-node";
7
7
  import {EventEmitter} from "events";
8
8
  import {SdCliElectron} from "./entry/SdCliElectron";
9
- import {SdCliLocalUpdate} from "./entry/SdCliLocalUpdate";
10
9
 
11
10
  Error.stackTraceLimit = Infinity;
12
11
  EventEmitter.defaultMaxListeners = 0;
13
12
 
14
13
  const argv = (
15
- await yargs(hideBin(process.argv))
16
- .help("help", "도움말")
17
- .alias("help", "h")
14
+ await yargs(hideBin(process.argv))
15
+ .help("help", "도움말")
16
+ .alias("help", "h")
17
+ .options({
18
+ debug: {
19
+ type: "boolean",
20
+ describe: "디버그 로그를 표시할 것인지 여부",
21
+ default: false
22
+ }
23
+ })
24
+ .command(
25
+ "watch",
26
+ "프로젝트의 각 패키지에 대한 변경감지 빌드를 수행합니다.",
27
+ (cmd) => cmd.version(false).hide("help").hide("debug")
18
28
  .options({
19
- debug: {
20
- type: "boolean",
21
- describe: "디버그 로그를 표시할 것인지 여부",
22
- default: false
23
- }
29
+ config: {
30
+ string: true,
31
+ describe: "simplysm.cjs 파일 경로"
32
+ },
33
+ options: {
34
+ string: true,
35
+ array: true,
36
+ describe: "옵션 설정"
37
+ },
38
+ packages: {
39
+ string: true,
40
+ array: true,
41
+ describe: "수행할 패키지 설정"
42
+ },
43
+ withoutLint: {
44
+ type: "boolean",
45
+ default: false,
46
+ describe: "린트 수행 여부"
47
+ }
24
48
  })
25
- .command(
26
- "local-update",
27
- "로컬 라이브러리 업데이트를 수행합니다.",
28
- (cmd) => cmd.version(false).hide("help").hide("debug")
29
- .options({
30
- config: {
31
- string: true,
32
- describe: "simplysm.cjs 파일 경로"
33
- },
34
- options: {
35
- string: true,
36
- array: true,
37
- describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
38
- },
39
- })
40
- )
41
- .command(
42
- "watch",
43
- "프로젝트의 패키지에 대한 변경감지 빌드를 수행합니다.",
44
- (cmd) => cmd.version(false).hide("help").hide("debug")
45
- .options({
46
- config: {
47
- string: true,
48
- describe: "simplysm.cjs 파일 경로"
49
- },
50
- options: {
51
- string: true,
52
- array: true,
53
- describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
54
- },
55
- packages: {
56
- string: true,
57
- array: true,
58
- describe: "수행할 패키지 설정"
59
- },
60
- withoutLint: {
61
- type: "boolean",
62
- default: false,
63
- describe: "린트 수행 여부"
64
- }
65
- })
66
- )
67
- .command(
68
- "build",
69
- "프로젝트의 각 패키지에 대한 빌드를 수행합니다.",
70
- (cmd) => cmd.version(false).hide("help").hide("debug")
71
- .options({
72
- config: {
73
- string: true,
74
- describe: "simplysm.cjs 파일 경로"
75
- },
76
- options: {
77
- string: true,
78
- array: true,
79
- describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
80
- },
81
- packages: {
82
- string: true,
83
- array: true,
84
- describe: "수행할 패키지 설정"
85
- },
86
- withoutLint: {
87
- type: "boolean",
88
- default: false,
89
- describe: "린트 수행 여부"
90
- }
91
- })
92
- )
93
- .command(
94
- "publish",
95
- "프로젝트의 패키지를 배포합니다.",
96
- (cmd) => cmd.version(false).hide("help").hide("debug")
97
- .options({
98
- noBuild: {
99
- type: "boolean",
100
- describe: "빌드를 하지않고 배포합니다.",
101
- default: false
102
- },
103
- config: {
104
- type: "string",
105
- describe: "simplysm.cjs 파일 경로"
106
- },
107
- options: {
108
- type: "string",
109
- array: true,
110
- describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
111
- },
112
- packages: {
113
- type: "string",
114
- array: true,
115
- describe: "수행할 패키지 설정"
116
- },
117
- withoutLint: {
118
- type: "boolean",
119
- default: false,
120
- describe: "린트 수행 여부"
121
- }
122
- })
123
- )
124
- .command(
125
- "run-electron <package>",
126
- "변경감지중인 플랫폼을 ELECTRON 앱 형태로 띄웁니다.",
127
- (cmd) => cmd
128
- .positional("package", {
129
- type: "string",
130
- describe: "패키지명",
131
- demandOption: true
132
- })
133
- .options({
134
- config: {
135
- type: "string",
136
- describe: "simplysm.json 파일 경로"
137
- },
138
- options: {
139
- type: "string",
140
- array: true,
141
- describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
142
- }
143
- })
144
- )
145
- .parseAsync()
49
+ )
50
+ .command(
51
+ "build",
52
+ "프로젝트의 패키지에 대한 빌드를 수행합니다.",
53
+ (cmd) => cmd.version(false).hide("help").hide("debug")
54
+ .options({
55
+ config: {
56
+ string: true,
57
+ describe: "simplysm.cjs 파일 경로"
58
+ },
59
+ options: {
60
+ string: true,
61
+ array: true,
62
+ describe: "옵션 설정"
63
+ },
64
+ packages: {
65
+ string: true,
66
+ array: true,
67
+ describe: "수행할 패키지 설정"
68
+ },
69
+ withoutLint: {
70
+ type: "boolean",
71
+ default: false,
72
+ describe: "린트 수행 여부"
73
+ }
74
+ })
75
+ )
76
+ .command(
77
+ "publish",
78
+ "프로젝트의 각 패키지를 배포합니다.",
79
+ (cmd) => cmd.version(false).hide("help").hide("debug")
80
+ .options({
81
+ noBuild: {
82
+ type: "boolean",
83
+ describe: "빌드를 하지않고 배포합니다.",
84
+ default: false
85
+ },
86
+ config: {
87
+ type: "string",
88
+ describe: "simplysm.cjs 파일 경로"
89
+ },
90
+ options: {
91
+ type: "string",
92
+ array: true,
93
+ describe: "옵션 설정"
94
+ },
95
+ packages: {
96
+ type: "string",
97
+ array: true,
98
+ describe: "수행할 패키지 설정"
99
+ },
100
+ withoutLint: {
101
+ type: "boolean",
102
+ default: false,
103
+ describe: "린트 수행 여부"
104
+ }
105
+ })
106
+ )
107
+ .command(
108
+ "run-electron <package>",
109
+ "변경감지중인 플랫폼을 ELECTRON 앱 형태로 띄웁니다.",
110
+ (cmd) => cmd
111
+ .positional("package", {
112
+ type: "string",
113
+ describe: "패키지명",
114
+ demandOption: true
115
+ })
116
+ .options({
117
+ config: {
118
+ type: "string",
119
+ describe: "simplysm.json 파일 경로"
120
+ },
121
+ options: {
122
+ type: "string",
123
+ array: true,
124
+ describe: "옵션 설정"
125
+ }
126
+ })
127
+ )
128
+ .command(
129
+ "build-electron-for-dev <package>",
130
+ "변경감지중인 플랫폼을 ELECTRON 앱 형태로 띄웁니다.",
131
+ (cmd) => cmd
132
+ .positional("package", {
133
+ type: "string",
134
+ describe: "패키지명",
135
+ demandOption: true
136
+ })
137
+ .options({
138
+ config: {
139
+ type: "string",
140
+ describe: "simplysm.json 파일 경로"
141
+ },
142
+ options: {
143
+ type: "string",
144
+ array: true,
145
+ describe: "옵션 설정"
146
+ }
147
+ })
148
+ )
149
+ .parseAsync()
146
150
  ) as any;
147
151
 
148
152
  if (Boolean(argv.debug)) {
149
- process.env["SD_DEBUG"] = "true";
150
- Logger.setConfig({
151
- console: {
152
- level: LoggerSeverity.debug
153
- }
154
- });
155
- } else {
156
- Logger.setConfig({
157
- dot: true
158
- });
153
+ process.env["SD_DEBUG"] = "true";
154
+ Logger.setConfig({
155
+ console: {
156
+ level: LoggerSeverity.debug
157
+ }
158
+ });
159
+ }
160
+ else {
161
+ Logger.setConfig({
162
+ dot: true
163
+ });
159
164
  }
160
165
 
161
166
  if (argv._[0] === "watch") {
162
- await SdCliProject
163
- .watchAsync({
164
- confFileRelPath: argv.config ?? "simplysm.cjs",
165
- optNames: argv.options ?? [],
166
- pkgNames: argv.packages ?? [],
167
- withLint: argv.withoutLint !== true
168
- });
169
- } else if (argv._[0] === "build") {
170
- await SdCliProject
171
- .buildAsync({
172
- confFileRelPath: argv.config ?? "simplysm.cjs",
173
- optNames: argv.options ?? [],
174
- pkgNames: argv.packages ?? [],
175
- withLint: argv.withoutLint !== true
176
- });
177
- } else if (argv._[0] === "publish") {
178
- await SdCliProject
179
- .publishAsync({
180
- noBuild: argv.noBuild,
181
- confFileRelPath: argv.config ?? "simplysm.cjs",
182
- optNames: argv.options ?? [],
183
- pkgNames: argv.packages ?? [],
184
- withLint: argv.withoutLint !== true
185
- });
186
- } else if (argv._[0] === "run-electron") {
187
- await SdCliElectron
188
- .runAsync({
189
- confFileRelPath: argv.config ?? "simplysm.cjs",
190
- optNames: argv.options ?? [],
191
- pkgName: argv.package
192
- });
193
- } else if (argv._[0] === "local-update") {
194
- await SdCliLocalUpdate
195
- .runAsync({
196
- confFileRelPath: argv.config ?? "simplysm.cjs",
197
- optNames: argv.options ?? []
198
- });
199
- } else {
200
- throw new Error(`명령어가 잘못 되었습니다.\n\t${argv._[0]}\n`);
167
+ await SdCliProject
168
+ .watchAsync({
169
+ confFileRelPath: argv.config ?? "simplysm.cjs",
170
+ optNames: argv.options ?? [],
171
+ pkgNames: argv.packages ?? [],
172
+ withLint: argv.withoutLint !== true
173
+ });
174
+ }
175
+ else if (argv._[0] === "build") {
176
+ await SdCliProject
177
+ .buildAsync({
178
+ confFileRelPath: argv.config ?? "simplysm.cjs",
179
+ optNames: argv.options ?? [],
180
+ pkgNames: argv.packages ?? [],
181
+ withLint: argv.withoutLint !== true
182
+ });
183
+ }
184
+ else if (argv._[0] === "publish") {
185
+ await SdCliProject
186
+ .publishAsync({
187
+ noBuild: argv.noBuild,
188
+ confFileRelPath: argv.config ?? "simplysm.cjs",
189
+ optNames: argv.options ?? [],
190
+ pkgNames: argv.packages ?? [],
191
+ withLint: argv.withoutLint !== true
192
+ });
193
+ }
194
+ else if (argv._[0] === "run-electron") {
195
+ await SdCliElectron
196
+ .runAsync({
197
+ confFileRelPath: argv.config ?? "simplysm.cjs",
198
+ optNames: argv.options ?? [],
199
+ pkgName: argv.package
200
+ });
201
+ }
202
+ else if (argv._[0] === "build-electron-for-dev") {
203
+ await SdCliElectron
204
+ .buildForDevAsync({
205
+ confFileRelPath: argv.config ?? "simplysm.cjs",
206
+ optNames: argv.options ?? [],
207
+ pkgName: argv.package
208
+ });
209
+ }
210
+ else {
211
+ throw new Error(`명령어가 잘못 되었습니다.\n\t${argv._[0]}\n`);
201
212
  }
@@ -1,7 +1,7 @@
1
1
  import ts from "typescript";
2
2
  import os from "os";
3
3
  import path from "path";
4
- import { ISdCliPackageBuildResult } from "../commons";
4
+ import {ISdCliPackageBuildResult} from "../commons";
5
5
 
6
6
  export class SdCliBuildResultUtil {
7
7
  public static convertFromTsDiag(diag: ts.Diagnostic): ISdCliPackageBuildResult {
@@ -24,7 +24,8 @@ export class SdCliBuildResultUtil {
24
24
  char,
25
25
  code,
26
26
  severity,
27
- message
27
+ message,
28
+ type: "build" as const
28
29
  };
29
30
  }
30
31
 
@@ -36,7 +37,7 @@ export class SdCliBuildResultUtil {
36
37
  if (result.code !== undefined) {
37
38
  str += `${result.code}: `;
38
39
  }
39
- str += `${result.severity} ${result.message}`;
40
+ str += `(${result.type}) ${result.severity} ${result.message}`;
40
41
 
41
42
  return str;
42
43
  }
@@ -1,12 +1,16 @@
1
1
  import {build, defineConfig, PluginOption, UserConfig} from "vite";
2
2
  import {SdCliViteExternalPlugin} from "./SdCliViteExternalPlugin";
3
3
  import path from "path";
4
+ import {SdCliViteLoggerPlugin} from "./SdCliViteLoggerPlugin";
5
+ import {Logger} from "@simplysm/sd-core-node";
4
6
 
5
7
  export const SdCliViteElectronMainPlugin = (opt: {
6
8
  entry: string;
7
9
  distPath: string;
8
10
  cachePath: string;
9
11
  }): PluginOption[] => {
12
+ const logger = Logger.get(["simplysm", "sd-cli", "SdCliViteElectronMainPlugin"]);
13
+
10
14
  let mainConfig: UserConfig;
11
15
 
12
16
  return [
@@ -30,11 +34,16 @@ export const SdCliViteElectronMainPlugin = (opt: {
30
34
  entry: opt.entry,
31
35
  formats: ["cjs"],
32
36
  fileName: () => "[name].js"
33
- }
37
+ },
38
+ emptyOutDir: false
34
39
  },
35
- customLogger: server.config.customLogger,
36
40
  plugins: [
41
+ SdCliViteLoggerPlugin({
42
+ logger,
43
+ name: path.basename(opt.entry)
44
+ }),
37
45
  SdCliViteExternalPlugin({
46
+ target: "node",
38
47
  cachePath: path.resolve(opt.cachePath, "externals"),
39
48
  nodeBuiltinModules: true,
40
49
  includes: ["electron"]
@@ -59,9 +68,6 @@ export const SdCliViteElectronMainPlugin = (opt: {
59
68
  mode: config.mode,
60
69
  define: config.define,
61
70
  root: config.root,
62
- resolve: {
63
- alias: config.resolve?.alias
64
- },
65
71
  optimizeDeps: {
66
72
  force: config.optimizeDeps?.force
67
73
  },
@@ -73,9 +79,21 @@ export const SdCliViteElectronMainPlugin = (opt: {
73
79
  entry: opt.entry,
74
80
  formats: ["cjs"],
75
81
  fileName: () => "[name].js"
76
- }
82
+ },
83
+ emptyOutDir: false
77
84
  },
78
- customLogger: config.customLogger
85
+ plugins: [
86
+ SdCliViteLoggerPlugin({
87
+ logger,
88
+ name: path.basename(opt.entry)
89
+ }),
90
+ SdCliViteExternalPlugin({
91
+ target: "node",
92
+ cachePath: path.resolve(opt.cachePath, "externals"),
93
+ nodeBuiltinModules: true,
94
+ includes: ["electron"]
95
+ }),
96
+ ]
79
97
  });
80
98
  },
81
99
  closeBundle: async () => {
@@ -8,6 +8,7 @@ import libEsm from "lib-esm";
8
8
  import esbuild from "esbuild";
9
9
 
10
10
  export const SdCliViteExternalPlugin = (opt: {
11
+ target: "browser" | "node";
11
12
  cachePath: string;
12
13
  nodeBuiltinModules?: boolean;
13
14
  dependencies?: boolean;
@@ -15,16 +16,15 @@ export const SdCliViteExternalPlugin = (opt: {
15
16
  }): PluginOption[] => {
16
17
  const externals = opt.includes ?? [];
17
18
 
18
- const builtins =[
19
+ const builtins = [
19
20
  ...builtinModules,
20
21
  ...builtinModules.map((item) => `node:${item}`)
21
22
  ];
22
23
 
23
24
  return [
24
- {
25
+ opt.target === "node" ? {
25
26
  name: "sd-cli:vite:external",
26
27
  enforce: "pre",
27
- apply: "build",
28
28
  config: (conf) => {
29
29
  if (opt.dependencies) {
30
30
  const npmConfigPath = FsUtil.findAllParentChildPaths("package.json", conf.root ?? opt.cachePath).first()!;
@@ -37,20 +37,25 @@ export const SdCliViteExternalPlugin = (opt: {
37
37
  resolveId: (source, importer) => {
38
38
  if (importer === undefined) return;
39
39
 
40
- if ([...externals, ...builtins].includes(source)) {
40
+ if (externals.includes(source)) {
41
41
  return {
42
42
  id: source,
43
43
  external: true
44
44
  };
45
45
  }
46
46
 
47
+ if (builtins.includes(source)) {
48
+ return {
49
+ id: `node:${source}`,
50
+ external: true
51
+ };
52
+ }
53
+
47
54
  return;
48
55
  }
49
- },
50
- {
56
+ } : {
51
57
  name: "sd-cli:vite:external",
52
58
  enforce: "pre",
53
- apply: "serve",
54
59
  config: (conf) => {
55
60
  if (opt.dependencies) {
56
61
  const npmConfigPath = FsUtil.findAllParentChildPaths("package.json", conf.root ?? opt.cachePath).first()!;
@@ -1,7 +1,7 @@
1
- import { PluginOption } from "vite";
1
+ import {PluginOption} from "vite";
2
2
  import stdLibBrowser from "node-stdlib-browser";
3
3
  import inject from "@rollup/plugin-inject";
4
- import { fileURLToPath } from "url";
4
+ import {fileURLToPath} from "url";
5
5
 
6
6
  const esbuildShim = fileURLToPath(await import.meta.resolve!("node-stdlib-browser/helpers/esbuild/shim"));
7
7
 
@@ -20,12 +20,12 @@ export const SdCliViteNodeGlobalPlugin = (): PluginOption[] => {
20
20
  }),
21
21
  },
22
22
  {
23
+ enforce: "post",
23
24
  ...inject({
24
25
  global: [esbuildShim, 'global'],
25
26
  process: [esbuildShim, 'process'],
26
27
  Buffer: [esbuildShim, 'Buffer']
27
- }),
28
- enforce: 'post'
29
- }
28
+ })
29
+ } as PluginOption
30
30
  ];
31
31
  };
@@ -1,7 +1,7 @@
1
- import { PluginOption } from "vite";
2
- import { FsUtil } from "@simplysm/sd-core-node";
3
- import { SourceMapPayload } from "module";
4
- import { Output, ParserConfig, transform, } from "@swc/core";
1
+ import {PluginOption} from "vite";
2
+ import {FsUtil} from "@simplysm/sd-core-node";
3
+ import {SourceMapPayload} from "module";
4
+ import {Output, ParserConfig, transform,} from "@swc/core";
5
5
  import path from "path";
6
6
 
7
7
  const runtimePublicPath = "/@react-refresh";
@@ -127,10 +127,8 @@ const transformWithOptions = async (
127
127
  react: {
128
128
  runtime: "automatic",
129
129
  importSource: "react",
130
- ...dev ? {
131
- refresh: true,
132
- development: true,
133
- } : {}
130
+ refresh: dev,
131
+ development: dev,
134
132
  },
135
133
  decoratorMetadata: true
136
134
  },