@simplysm/sd-cli 13.0.100 → 14.0.1
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/dist/commands/build.js +29 -19
- package/dist/commands/build.js.map +1 -6
- package/dist/commands/check.d.ts +1 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +130 -115
- package/dist/commands/check.js.map +1 -6
- package/dist/commands/dev.d.ts +6 -7
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +24 -14
- package/dist/commands/dev.js.map +1 -6
- package/dist/commands/lint.d.ts +1 -1
- package/dist/commands/lint.js +158 -116
- package/dist/commands/lint.js.map +1 -6
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +637 -510
- package/dist/commands/publish.js.map +1 -6
- package/dist/commands/replace-deps.js +12 -12
- package/dist/commands/replace-deps.js.map +1 -6
- package/dist/commands/typecheck.d.ts +5 -30
- package/dist/commands/typecheck.d.ts.map +1 -1
- package/dist/commands/typecheck.js +144 -207
- package/dist/commands/typecheck.js.map +1 -6
- package/dist/commands/watch.d.ts +6 -4
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +25 -16
- package/dist/commands/watch.js.map +1 -6
- package/dist/engines/NgtscEngine.d.ts +47 -0
- package/dist/engines/NgtscEngine.d.ts.map +1 -0
- package/dist/engines/NgtscEngine.js +151 -0
- package/dist/engines/NgtscEngine.js.map +1 -0
- package/dist/engines/ServerEsbuildEngine.d.ts +47 -0
- package/dist/engines/ServerEsbuildEngine.d.ts.map +1 -0
- package/dist/engines/ServerEsbuildEngine.js +159 -0
- package/dist/engines/ServerEsbuildEngine.js.map +1 -0
- package/dist/engines/TscEngine.d.ts +47 -0
- package/dist/engines/TscEngine.d.ts.map +1 -0
- package/dist/engines/TscEngine.js +153 -0
- package/dist/engines/TscEngine.js.map +1 -0
- package/dist/engines/ViteEngine.d.ts +49 -0
- package/dist/engines/ViteEngine.d.ts.map +1 -0
- package/dist/engines/ViteEngine.js +161 -0
- package/dist/engines/ViteEngine.js.map +1 -0
- package/dist/engines/index.d.ts +26 -0
- package/dist/engines/index.d.ts.map +1 -0
- package/dist/engines/index.js +30 -0
- package/dist/engines/index.js.map +1 -0
- package/dist/engines/types.d.ts +77 -0
- package/dist/engines/types.d.ts.map +1 -0
- package/dist/engines/types.js +2 -0
- package/dist/engines/types.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -6
- package/dist/infra/ResultCollector.d.ts +1 -1
- package/dist/infra/ResultCollector.d.ts.map +1 -1
- package/dist/infra/ResultCollector.js +30 -27
- package/dist/infra/ResultCollector.js.map +1 -6
- package/dist/infra/SignalHandler.js +45 -42
- package/dist/infra/SignalHandler.js.map +1 -6
- package/dist/infra/WorkerManager.js +56 -53
- package/dist/infra/WorkerManager.js.map +1 -6
- package/dist/orchestrators/BuildOrchestrator.d.ts +33 -1
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +314 -309
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -6
- package/dist/orchestrators/DevWatchOrchestrator.d.ts +60 -0
- package/dist/orchestrators/DevWatchOrchestrator.d.ts.map +1 -0
- package/dist/orchestrators/DevWatchOrchestrator.js +465 -0
- package/dist/orchestrators/DevWatchOrchestrator.js.map +1 -0
- package/dist/sd-cli-entry.d.ts.map +1 -1
- package/dist/sd-cli-entry.js +190 -266
- package/dist/sd-cli-entry.js.map +1 -6
- package/dist/sd-cli.js +77 -49
- package/dist/sd-cli.js.map +1 -6
- package/dist/sd-config.types.d.ts +2 -0
- package/dist/sd-config.types.d.ts.map +1 -1
- package/dist/sd-config.types.js +2 -1
- package/dist/sd-config.types.js.map +1 -6
- package/dist/utils/angular-build.d.ts +77 -0
- package/dist/utils/angular-build.d.ts.map +1 -0
- package/dist/utils/angular-build.js +84 -0
- package/dist/utils/angular-build.js.map +1 -0
- package/dist/utils/build-env.js +9 -9
- package/dist/utils/build-env.js.map +1 -6
- package/dist/utils/concurrency.d.ts +15 -0
- package/dist/utils/concurrency.d.ts.map +1 -0
- package/dist/utils/concurrency.js +38 -0
- package/dist/utils/concurrency.js.map +1 -0
- package/dist/utils/copy-public.js +104 -87
- package/dist/utils/copy-public.js.map +1 -6
- package/dist/utils/copy-src.js +49 -35
- package/dist/utils/copy-src.js.map +1 -6
- package/dist/utils/esbuild-config.d.ts +0 -29
- package/dist/utils/esbuild-config.d.ts.map +1 -1
- package/dist/utils/esbuild-config.js +151 -218
- package/dist/utils/esbuild-config.js.map +1 -6
- package/dist/utils/ngtsc-build-core.d.ts +49 -0
- package/dist/utils/ngtsc-build-core.d.ts.map +1 -0
- package/dist/utils/ngtsc-build-core.js +250 -0
- package/dist/utils/ngtsc-build-core.js.map +1 -0
- package/dist/utils/output-path-rewriter.d.ts +23 -0
- package/dist/utils/output-path-rewriter.d.ts.map +1 -0
- package/dist/utils/output-path-rewriter.js +74 -0
- package/dist/utils/output-path-rewriter.js.map +1 -0
- package/dist/utils/output-utils.js +55 -40
- package/dist/utils/output-utils.js.map +1 -6
- package/dist/utils/package-utils.d.ts +8 -0
- package/dist/utils/package-utils.d.ts.map +1 -1
- package/dist/utils/package-utils.js +103 -73
- package/dist/utils/package-utils.js.map +1 -6
- package/dist/utils/rebuild-manager.js +41 -44
- package/dist/utils/rebuild-manager.js.map +1 -6
- package/dist/utils/replace-deps.js +283 -184
- package/dist/utils/replace-deps.js.map +1 -6
- package/dist/utils/scss-compiler.d.ts +10 -0
- package/dist/utils/scss-compiler.d.ts.map +1 -0
- package/dist/utils/scss-compiler.js +36 -0
- package/dist/utils/scss-compiler.js.map +1 -0
- package/dist/utils/sd-config.js +29 -19
- package/dist/utils/sd-config.js.map +1 -6
- package/dist/utils/tsc-build.d.ts +36 -0
- package/dist/utils/tsc-build.d.ts.map +1 -0
- package/dist/utils/tsc-build.js +130 -0
- package/dist/utils/tsc-build.js.map +1 -0
- package/dist/utils/tsconfig.d.ts +7 -26
- package/dist/utils/tsconfig.d.ts.map +1 -1
- package/dist/utils/tsconfig.js +39 -64
- package/dist/utils/tsconfig.js.map +1 -6
- package/dist/utils/typecheck-non-package.d.ts +18 -0
- package/dist/utils/typecheck-non-package.d.ts.map +1 -0
- package/dist/utils/typecheck-non-package.js +64 -0
- package/dist/utils/typecheck-non-package.js.map +1 -0
- package/dist/utils/typecheck-serialization.js +58 -40
- package/dist/utils/typecheck-serialization.js.map +1 -6
- package/dist/utils/worker-events.js +48 -40
- package/dist/utils/worker-events.js.map +1 -6
- package/dist/utils/worker-utils.js +48 -28
- package/dist/utils/worker-utils.js.map +1 -6
- package/dist/vitest-plugin.d.ts +9 -0
- package/dist/vitest-plugin.d.ts.map +1 -0
- package/dist/vitest-plugin.js +85 -0
- package/dist/vitest-plugin.js.map +1 -0
- package/dist/workers/library-build.worker.d.ts +54 -0
- package/dist/workers/library-build.worker.d.ts.map +1 -0
- package/dist/workers/library-build.worker.js +97 -0
- package/dist/workers/library-build.worker.js.map +1 -0
- package/dist/workers/lint.worker.js +9 -6
- package/dist/workers/lint.worker.js.map +1 -6
- package/dist/workers/ngtsc-build.worker.d.ts +23 -0
- package/dist/workers/ngtsc-build.worker.d.ts.map +1 -0
- package/dist/workers/ngtsc-build.worker.js +98 -0
- package/dist/workers/ngtsc-build.worker.js.map +1 -0
- package/dist/workers/{server.worker.d.ts → server-build.worker.d.ts} +39 -29
- package/dist/workers/server-build.worker.d.ts.map +1 -0
- package/dist/workers/server-build.worker.js +399 -0
- package/dist/workers/server-build.worker.js.map +1 -0
- package/dist/workers/server-runtime.worker.d.ts +3 -2
- package/dist/workers/server-runtime.worker.d.ts.map +1 -1
- package/dist/workers/server-runtime.worker.js +100 -95
- package/dist/workers/server-runtime.worker.js.map +1 -6
- package/dist/workers/vite-build.worker.d.ts +56 -0
- package/dist/workers/vite-build.worker.d.ts.map +1 -0
- package/dist/workers/vite-build.worker.js +167 -0
- package/dist/workers/vite-build.worker.js.map +1 -0
- package/package.json +10 -16
- package/src/commands/check.ts +21 -3
- package/src/commands/dev.ts +10 -8
- package/src/commands/lint.ts +1 -1
- package/src/commands/publish.ts +4 -0
- package/src/commands/typecheck.ts +89 -256
- package/src/commands/watch.ts +9 -8
- package/src/engines/NgtscEngine.ts +190 -0
- package/src/engines/ServerEsbuildEngine.ts +195 -0
- package/src/engines/TscEngine.ts +189 -0
- package/src/engines/ViteEngine.ts +203 -0
- package/src/engines/index.ts +49 -0
- package/src/engines/types.ts +79 -0
- package/src/index.ts +0 -3
- package/src/infra/ResultCollector.ts +1 -1
- package/src/orchestrators/BuildOrchestrator.ts +87 -157
- package/src/orchestrators/DevWatchOrchestrator.ts +573 -0
- package/src/sd-cli-entry.ts +13 -116
- package/src/sd-config.types.ts +2 -0
- package/src/utils/angular-build.ts +157 -0
- package/src/utils/concurrency.ts +43 -0
- package/src/utils/esbuild-config.ts +1 -122
- package/src/utils/ngtsc-build-core.ts +379 -0
- package/src/utils/output-path-rewriter.ts +82 -0
- package/src/utils/package-utils.ts +20 -0
- package/src/utils/scss-compiler.ts +58 -0
- package/src/utils/tsc-build.ts +175 -0
- package/src/utils/tsconfig.ts +27 -95
- package/src/utils/typecheck-non-package.ts +87 -0
- package/src/vitest-plugin.ts +118 -0
- package/src/workers/library-build.worker.ts +153 -0
- package/src/workers/ngtsc-build.worker.ts +146 -0
- package/src/workers/server-build.worker.ts +565 -0
- package/src/workers/server-runtime.worker.ts +17 -26
- package/src/workers/vite-build.worker.ts +252 -0
- package/tests/commands/check.spec.ts +276 -0
- package/tests/commands/dev.spec.ts +53 -0
- package/tests/commands/lint.spec.ts +243 -0
- package/tests/commands/publish.spec.ts +1159 -0
- package/tests/commands/typecheck.spec.ts +294 -0
- package/tests/commands/watch.spec.ts +53 -0
- package/tests/engines/engine-selection.spec.ts +247 -0
- package/tests/engines/ngtsc-engine.spec.ts +274 -0
- package/tests/engines/server-esbuild-engine.spec.ts +256 -0
- package/tests/engines/tsc-engine.spec.ts +213 -0
- package/tests/engines/vite-engine.spec.ts +358 -0
- package/tests/infra/result-collector.spec.ts +46 -0
- package/tests/infra/signal-handler.spec.ts +32 -0
- package/tests/infra/worker-manager.spec.ts +63 -0
- package/tests/orchestrators/build-orchestrator.spec.ts +772 -0
- package/tests/orchestrators/dev-watch-orchestrator.spec.ts +1173 -0
- package/tests/sd-cli-entry.spec.ts +49 -0
- package/tests/utils/angular-build.spec.ts +251 -0
- package/tests/utils/build-env.spec.ts +33 -0
- package/tests/utils/concurrency.spec.ts +65 -0
- package/tests/utils/copy-src.spec.ts +144 -0
- package/tests/utils/esbuild-config.spec.ts +186 -0
- package/tests/utils/external-modules.spec.ts +161 -0
- package/tests/utils/ngtsc-scss-refactor.spec.ts +66 -0
- package/tests/utils/output-path-rewriter.spec.ts +165 -0
- package/tests/utils/output-utils.spec.ts +104 -0
- package/tests/utils/package-utils.spec.ts +52 -0
- package/tests/utils/rebuild-manager.spec.ts +30 -27
- package/tests/utils/replace-deps.spec.ts +69 -0
- package/tests/utils/scss-compiler.spec.ts +131 -0
- package/tests/utils/sd-config.spec.ts +77 -0
- package/tests/utils/tsc-build.spec.ts +358 -0
- package/tests/utils/tsconfig-angular.spec.ts +71 -0
- package/tests/utils/typecheck-non-package.spec.ts +120 -0
- package/tests/utils/worker-events.spec.ts +155 -0
- package/tests/utils/worker-utils.spec.ts +43 -0
- package/tests/vitest-plugin-cwd.spec.ts +68 -0
- package/tests/vitest-plugin.spec.ts +103 -0
- package/tests/workers/library-build-worker.spec.ts +258 -0
- package/tests/workers/ngtsc-build-worker.spec.ts +187 -0
- package/tests/workers/server-build-worker.spec.ts +566 -0
- package/tests/workers/server-runtime-worker.spec.ts +251 -0
- package/README.md +0 -295
- package/dist/builders/BaseBuilder.d.ts +0 -88
- package/dist/builders/BaseBuilder.d.ts.map +0 -1
- package/dist/builders/BaseBuilder.js +0 -142
- package/dist/builders/BaseBuilder.js.map +0 -6
- package/dist/builders/DtsBuilder.d.ts +0 -22
- package/dist/builders/DtsBuilder.d.ts.map +0 -1
- package/dist/builders/DtsBuilder.js +0 -72
- package/dist/builders/DtsBuilder.js.map +0 -6
- package/dist/builders/LibraryBuilder.d.ts +0 -22
- package/dist/builders/LibraryBuilder.d.ts.map +0 -1
- package/dist/builders/LibraryBuilder.js +0 -85
- package/dist/builders/LibraryBuilder.js.map +0 -6
- package/dist/builders/types.d.ts +0 -55
- package/dist/builders/types.d.ts.map +0 -1
- package/dist/builders/types.js +0 -1
- package/dist/builders/types.js.map +0 -6
- package/dist/capacitor/capacitor.d.ts +0 -151
- package/dist/capacitor/capacitor.d.ts.map +0 -1
- package/dist/capacitor/capacitor.js +0 -694
- package/dist/capacitor/capacitor.js.map +0 -6
- package/dist/commands/device.d.ts +0 -22
- package/dist/commands/device.d.ts.map +0 -1
- package/dist/commands/device.js +0 -98
- package/dist/commands/device.js.map +0 -6
- package/dist/commands/init.d.ts +0 -14
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -72
- package/dist/commands/init.js.map +0 -6
- package/dist/electron/electron.d.ts +0 -84
- package/dist/electron/electron.d.ts.map +0 -1
- package/dist/electron/electron.js +0 -263
- package/dist/electron/electron.js.map +0 -6
- package/dist/orchestrators/DevOrchestrator.d.ts +0 -83
- package/dist/orchestrators/DevOrchestrator.d.ts.map +0 -1
- package/dist/orchestrators/DevOrchestrator.js +0 -540
- package/dist/orchestrators/DevOrchestrator.js.map +0 -6
- package/dist/orchestrators/WatchOrchestrator.d.ts +0 -57
- package/dist/orchestrators/WatchOrchestrator.d.ts.map +0 -1
- package/dist/orchestrators/WatchOrchestrator.js +0 -199
- package/dist/orchestrators/WatchOrchestrator.js.map +0 -6
- package/dist/utils/tailwind-config-deps.d.ts +0 -8
- package/dist/utils/tailwind-config-deps.d.ts.map +0 -1
- package/dist/utils/tailwind-config-deps.js +0 -82
- package/dist/utils/tailwind-config-deps.js.map +0 -6
- package/dist/utils/template.d.ts +0 -14
- package/dist/utils/template.d.ts.map +0 -1
- package/dist/utils/template.js +0 -33
- package/dist/utils/template.js.map +0 -6
- package/dist/utils/vite-config.d.ts +0 -35
- package/dist/utils/vite-config.d.ts.map +0 -1
- package/dist/utils/vite-config.js +0 -259
- package/dist/utils/vite-config.js.map +0 -6
- package/dist/workers/client.worker.d.ts +0 -83
- package/dist/workers/client.worker.d.ts.map +0 -1
- package/dist/workers/client.worker.js +0 -111
- package/dist/workers/client.worker.js.map +0 -6
- package/dist/workers/dts.worker.d.ts +0 -75
- package/dist/workers/dts.worker.d.ts.map +0 -1
- package/dist/workers/dts.worker.js +0 -270
- package/dist/workers/dts.worker.js.map +0 -6
- package/dist/workers/library.worker.d.ts +0 -75
- package/dist/workers/library.worker.d.ts.map +0 -1
- package/dist/workers/library.worker.js +0 -166
- package/dist/workers/library.worker.js.map +0 -6
- package/dist/workers/server.worker.d.ts.map +0 -1
- package/dist/workers/server.worker.js +0 -482
- package/dist/workers/server.worker.js.map +0 -6
- package/src/builders/BaseBuilder.ts +0 -218
- package/src/builders/DtsBuilder.ts +0 -92
- package/src/builders/LibraryBuilder.ts +0 -110
- package/src/builders/types.ts +0 -60
- package/src/capacitor/capacitor.ts +0 -931
- package/src/commands/device.ts +0 -140
- package/src/commands/init.ts +0 -113
- package/src/electron/electron.ts +0 -362
- package/src/orchestrators/DevOrchestrator.ts +0 -744
- package/src/orchestrators/WatchOrchestrator.ts +0 -277
- package/src/utils/tailwind-config-deps.ts +0 -98
- package/src/utils/template.ts +0 -56
- package/src/utils/vite-config.ts +0 -390
- package/src/workers/client.worker.ts +0 -250
- package/src/workers/dts.worker.ts +0 -453
- package/src/workers/library.worker.ts +0 -316
- package/src/workers/server.worker.ts +0 -734
- package/templates/init/.gitignore.hbs +0 -34
- package/templates/init/.npmrc.hbs +0 -1
- package/templates/init/.prettierignore +0 -1
- package/templates/init/.prettierrc.yaml +0 -12
- package/templates/init/eslint.config.ts +0 -15
- package/templates/init/mise.toml +0 -3
- package/templates/init/package.json.hbs +0 -32
- package/templates/init/packages/client-admin/index.html.hbs +0 -144
- package/templates/init/packages/client-admin/package.json.hbs +0 -27
- package/templates/init/packages/client-admin/public/assets/logo-landscape.png +0 -0
- package/templates/init/packages/client-admin/public/assets/logo.png +0 -0
- package/templates/init/packages/client-admin/public/favicon.ico +0 -0
- package/templates/init/packages/client-admin/src/App.tsx +0 -42
- package/templates/init/packages/client-admin/src/dev/DevDialog.tsx +0 -34
- package/templates/init/packages/client-admin/src/events/AuthChangeEvent.ts +0 -3
- package/templates/init/packages/client-admin/src/main.css +0 -4
- package/templates/init/packages/client-admin/src/main.tsx.hbs +0 -146
- package/templates/init/packages/client-admin/src/providers/AppServiceProvider.tsx.hbs +0 -103
- package/templates/init/packages/client-admin/src/providers/AppStructureProvider.tsx +0 -84
- package/templates/init/packages/client-admin/src/providers/AuthProvider.tsx.hbs +0 -96
- package/templates/init/packages/client-admin/src/providers/configureSharedData.ts.hbs +0 -67
- package/templates/init/packages/client-admin/src/views/auth/LoginView.tsx +0 -132
- package/templates/init/packages/client-admin/src/views/home/HomeView.tsx +0 -108
- package/templates/init/packages/client-admin/src/views/home/base/employee/EmployeeDetail.tsx.hbs +0 -243
- package/templates/init/packages/client-admin/src/views/home/base/employee/EmployeeSheet.tsx.hbs +0 -271
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RoleDetail.tsx.hbs +0 -146
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RolePermissionDetail.tsx.hbs +0 -121
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RolePermissionView.tsx +0 -52
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RoleSheet.tsx.hbs +0 -125
- package/templates/init/packages/client-admin/src/views/home/main/MainView.tsx.hbs +0 -13
- package/templates/init/packages/client-admin/src/views/home/my-info/MyInfoDetail.tsx.hbs +0 -241
- package/templates/init/packages/client-admin/src/views/home/system/system-log/SystemLogSheet.tsx.hbs +0 -169
- package/templates/init/packages/client-admin/src/views/not-found/NotFoundView.tsx +0 -15
- package/templates/init/packages/client-admin/tailwind.config.ts +0 -10
- package/templates/init/packages/db-main/package.json.hbs +0 -13
- package/templates/init/packages/db-main/src/MainDbContext.ts +0 -22
- package/templates/init/packages/db-main/src/dataLogExt.ts +0 -127
- package/templates/init/packages/db-main/src/index.ts +0 -14
- package/templates/init/packages/db-main/src/tables/base/Employee.ts +0 -24
- package/templates/init/packages/db-main/src/tables/base/EmployeeConfig.ts +0 -13
- package/templates/init/packages/db-main/src/tables/base/Role.ts +0 -9
- package/templates/init/packages/db-main/src/tables/base/RolePermission.ts +0 -13
- package/templates/init/packages/db-main/src/tables/system/_DataLog.ts +0 -19
- package/templates/init/packages/db-main/src/tables/system/_Log.ts +0 -16
- package/templates/init/packages/server/package.json.hbs +0 -20
- package/templates/init/packages/server/public-dev/dev//354/264/210/352/270/260/355/231/224.xlsx +0 -0
- package/templates/init/packages/server/src/index.ts +0 -4
- package/templates/init/packages/server/src/main.ts.hbs +0 -34
- package/templates/init/packages/server/src/services/AuthService.ts.hbs +0 -171
- package/templates/init/packages/server/src/services/DevService.ts.hbs +0 -94
- package/templates/init/packages/server/src/services/EmployeeService.ts.hbs +0 -122
- package/templates/init/packages/server/src/services/RoleService.ts.hbs +0 -59
- package/templates/init/pnpm-workspace.yaml +0 -15
- package/templates/init/sd.config.ts.hbs +0 -48
- package/templates/init/tsconfig.json.hbs +0 -39
- package/templates/init/vitest.config.ts +0 -36
- package/tests/capacitor-exclude.spec.ts +0 -78
- package/tests/capacitor.spec.ts +0 -49
- package/tests/copy-src.spec.ts +0 -50
- package/tests/electron-exclude.spec.ts +0 -61
- package/tests/get-compiler-options-for-package.spec.ts +0 -80
- package/tests/get-package-source-files.spec.ts +0 -139
- package/tests/get-types-from-package-json.spec.ts +0 -92
- package/tests/infra/ResultCollector.spec.ts +0 -30
- package/tests/infra/SignalHandler.spec.ts +0 -38
- package/tests/infra/WorkerManager.spec.ts +0 -63
- package/tests/load-ignore-patterns.spec.ts +0 -163
- package/tests/load-sd-config.spec.ts +0 -100
- package/tests/package-utils.spec.ts +0 -188
- package/tests/parse-root-tsconfig.spec.ts +0 -89
- package/tests/publish-config-narrowing.spec.ts +0 -20
- package/tests/replace-deps.spec.ts +0 -308
- package/tests/run-lint.spec.ts +0 -366
- package/tests/run-typecheck.spec.ts +0 -544
- package/tests/run-watch.spec.ts +0 -76
- package/tests/sd-cli.spec.ts +0 -265
- package/tests/sd-public-dev-plugin-mime.spec.ts +0 -19
- package/tests/tailwind-config-deps.spec.ts +0 -30
- package/tests/template.spec.ts +0 -70
- package/tests/vite-config-exclude.spec.ts +0 -35
- package/tests/vite-config-outdir.spec.ts +0 -38
- package/tests/write-changed-output-files.spec.ts +0 -97
package/src/sd-cli-entry.ts
CHANGED
|
@@ -5,15 +5,12 @@
|
|
|
5
5
|
import "@simplysm/core-common";
|
|
6
6
|
import yargs, { type Argv } from "yargs";
|
|
7
7
|
import { hideBin } from "yargs/helpers";
|
|
8
|
-
import { runLint } from "./commands/lint";
|
|
9
|
-
import { runTypecheck } from "./commands/typecheck";
|
|
10
8
|
import { runCheck, type CheckType } from "./commands/check";
|
|
11
9
|
import { runWatch } from "./commands/watch";
|
|
12
10
|
import { runDev } from "./commands/dev";
|
|
13
11
|
import { runBuild } from "./commands/build";
|
|
14
12
|
import { runPublish } from "./commands/publish";
|
|
15
13
|
import { runReplaceDeps } from "./commands/replace-deps";
|
|
16
|
-
import { runDevice } from "./commands/device";
|
|
17
14
|
import path from "path";
|
|
18
15
|
import fs from "fs";
|
|
19
16
|
import { fileURLToPath } from "url";
|
|
@@ -23,7 +20,7 @@ import { consola, LogLevels } from "consola";
|
|
|
23
20
|
Error.stackTraceLimit = Infinity;
|
|
24
21
|
EventEmitter.defaultMaxListeners = 100;
|
|
25
22
|
|
|
26
|
-
const COMMAND_NAMES = ["
|
|
23
|
+
const COMMAND_NAMES = ["check", "watch", "dev", "build", "publish", "replace-deps"];
|
|
27
24
|
|
|
28
25
|
async function collectYargsHelp(argv: string[]): Promise<string> {
|
|
29
26
|
const lines: string[] = [];
|
|
@@ -82,68 +79,6 @@ export function createCliParser(argv: string[]): Argv {
|
|
|
82
79
|
process.env["SD_DEBUG"] = "true";
|
|
83
80
|
}
|
|
84
81
|
})
|
|
85
|
-
.command(
|
|
86
|
-
"lint [targets..]",
|
|
87
|
-
"Run ESLint + Stylelint",
|
|
88
|
-
(cmd) =>
|
|
89
|
-
cmd
|
|
90
|
-
.version(false)
|
|
91
|
-
.hide("help")
|
|
92
|
-
.positional("targets", {
|
|
93
|
-
type: "string",
|
|
94
|
-
array: true,
|
|
95
|
-
describe: "Paths to lint (e.g., packages/core-common, tests/orm)",
|
|
96
|
-
default: [],
|
|
97
|
-
})
|
|
98
|
-
.options({
|
|
99
|
-
fix: {
|
|
100
|
-
type: "boolean",
|
|
101
|
-
describe: "Auto-fix issues",
|
|
102
|
-
default: false,
|
|
103
|
-
},
|
|
104
|
-
timing: {
|
|
105
|
-
type: "boolean",
|
|
106
|
-
describe: "Print execution time per rule",
|
|
107
|
-
default: false,
|
|
108
|
-
},
|
|
109
|
-
}),
|
|
110
|
-
async (args) => {
|
|
111
|
-
await runLint({
|
|
112
|
-
targets: args.targets,
|
|
113
|
-
fix: args.fix,
|
|
114
|
-
timing: args.timing,
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
)
|
|
118
|
-
.command(
|
|
119
|
-
"typecheck [targets..]",
|
|
120
|
-
"Run TypeScript type checking",
|
|
121
|
-
(cmd) =>
|
|
122
|
-
cmd
|
|
123
|
-
.version(false)
|
|
124
|
-
.hide("help")
|
|
125
|
-
.positional("targets", {
|
|
126
|
-
type: "string",
|
|
127
|
-
array: true,
|
|
128
|
-
describe: "Paths to typecheck (e.g., packages/core-common, tests/orm)",
|
|
129
|
-
default: [],
|
|
130
|
-
})
|
|
131
|
-
.options({
|
|
132
|
-
opt: {
|
|
133
|
-
type: "string",
|
|
134
|
-
array: true,
|
|
135
|
-
alias: "o",
|
|
136
|
-
description: "Options to pass to sd.config.ts (e.g., -o key=value)",
|
|
137
|
-
default: [] as string[],
|
|
138
|
-
},
|
|
139
|
-
}),
|
|
140
|
-
async (args) => {
|
|
141
|
-
await runTypecheck({
|
|
142
|
-
targets: args.targets,
|
|
143
|
-
options: args.opt,
|
|
144
|
-
});
|
|
145
|
-
},
|
|
146
|
-
)
|
|
147
82
|
.command(
|
|
148
83
|
"check [targets..]",
|
|
149
84
|
"Run Typecheck, Lint, Test in parallel",
|
|
@@ -154,7 +89,7 @@ export function createCliParser(argv: string[]): Argv {
|
|
|
154
89
|
.positional("targets", {
|
|
155
90
|
type: "string",
|
|
156
91
|
array: true,
|
|
157
|
-
describe: "
|
|
92
|
+
describe: "Packages to check (e.g., core-common, storage)",
|
|
158
93
|
default: [],
|
|
159
94
|
})
|
|
160
95
|
.options({
|
|
@@ -163,11 +98,17 @@ export function createCliParser(argv: string[]): Argv {
|
|
|
163
98
|
describe: "Check types to run (comma-separated: typecheck,lint,test)",
|
|
164
99
|
default: "typecheck,lint,test",
|
|
165
100
|
},
|
|
101
|
+
fix: {
|
|
102
|
+
type: "boolean",
|
|
103
|
+
describe: "Auto-fix lint issues",
|
|
104
|
+
default: false,
|
|
105
|
+
},
|
|
166
106
|
}),
|
|
167
107
|
async (args) => {
|
|
168
108
|
await runCheck({
|
|
169
109
|
targets: args.targets,
|
|
170
110
|
types: args.type.split(",").map((t) => t.trim()) as CheckType[],
|
|
111
|
+
fix: args.fix,
|
|
171
112
|
});
|
|
172
113
|
},
|
|
173
114
|
)
|
|
@@ -181,7 +122,7 @@ export function createCliParser(argv: string[]): Argv {
|
|
|
181
122
|
.positional("targets", {
|
|
182
123
|
type: "string",
|
|
183
124
|
array: true,
|
|
184
|
-
describe: "Packages to watch (e.g.,
|
|
125
|
+
describe: "Packages to watch (e.g., core-common, storage)",
|
|
185
126
|
default: [],
|
|
186
127
|
})
|
|
187
128
|
.options({
|
|
@@ -202,7 +143,7 @@ export function createCliParser(argv: string[]): Argv {
|
|
|
202
143
|
)
|
|
203
144
|
.command(
|
|
204
145
|
"dev [targets..]",
|
|
205
|
-
"Run
|
|
146
|
+
"Run Server packages in dev mode",
|
|
206
147
|
(cmd) =>
|
|
207
148
|
cmd
|
|
208
149
|
.version(false)
|
|
@@ -210,7 +151,7 @@ export function createCliParser(argv: string[]): Argv {
|
|
|
210
151
|
.positional("targets", {
|
|
211
152
|
type: "string",
|
|
212
153
|
array: true,
|
|
213
|
-
describe: "Packages to run (e.g.,
|
|
154
|
+
describe: "Packages to run (e.g., service-server)",
|
|
214
155
|
default: [],
|
|
215
156
|
})
|
|
216
157
|
.options({
|
|
@@ -239,7 +180,7 @@ export function createCliParser(argv: string[]): Argv {
|
|
|
239
180
|
.positional("targets", {
|
|
240
181
|
type: "string",
|
|
241
182
|
array: true,
|
|
242
|
-
describe: "Packages to build (e.g.,
|
|
183
|
+
describe: "Packages to build (e.g., core-common, storage)",
|
|
243
184
|
default: [],
|
|
244
185
|
})
|
|
245
186
|
.options({
|
|
@@ -258,50 +199,6 @@ export function createCliParser(argv: string[]): Argv {
|
|
|
258
199
|
});
|
|
259
200
|
},
|
|
260
201
|
)
|
|
261
|
-
.command(
|
|
262
|
-
"device",
|
|
263
|
-
"Run app on Android device",
|
|
264
|
-
(cmd) =>
|
|
265
|
-
cmd
|
|
266
|
-
.version(false)
|
|
267
|
-
.hide("help")
|
|
268
|
-
.options({
|
|
269
|
-
package: {
|
|
270
|
-
type: "string",
|
|
271
|
-
alias: "p",
|
|
272
|
-
describe: "Package name",
|
|
273
|
-
demandOption: true,
|
|
274
|
-
},
|
|
275
|
-
url: {
|
|
276
|
-
type: "string",
|
|
277
|
-
alias: "u",
|
|
278
|
-
describe: "Development server URL (if not specified, use server config from sd.config.ts)",
|
|
279
|
-
},
|
|
280
|
-
opt: {
|
|
281
|
-
type: "string",
|
|
282
|
-
array: true,
|
|
283
|
-
alias: "o",
|
|
284
|
-
description: "Options to pass to sd.config.ts (e.g., -o key=value)",
|
|
285
|
-
default: [] as string[],
|
|
286
|
-
},
|
|
287
|
-
}),
|
|
288
|
-
async (args) => {
|
|
289
|
-
await runDevice({
|
|
290
|
-
package: args.package,
|
|
291
|
-
url: args.url,
|
|
292
|
-
options: args.opt,
|
|
293
|
-
});
|
|
294
|
-
},
|
|
295
|
-
)
|
|
296
|
-
.command(
|
|
297
|
-
"init",
|
|
298
|
-
"Initialize new project",
|
|
299
|
-
(cmd) => cmd.version(false).hide("help"),
|
|
300
|
-
async () => {
|
|
301
|
-
const { runInit } = await import("./commands/init.js");
|
|
302
|
-
await runInit({});
|
|
303
|
-
},
|
|
304
|
-
)
|
|
305
202
|
.command(
|
|
306
203
|
"publish [targets..]",
|
|
307
204
|
"Publish packages",
|
|
@@ -312,7 +209,7 @@ export function createCliParser(argv: string[]): Argv {
|
|
|
312
209
|
.positional("targets", {
|
|
313
210
|
type: "string",
|
|
314
211
|
array: true,
|
|
315
|
-
describe: "Packages to publish (e.g.,
|
|
212
|
+
describe: "Packages to publish (e.g., core-common, storage)",
|
|
316
213
|
default: [],
|
|
317
214
|
})
|
|
318
215
|
.options({
|
package/src/sd-config.types.ts
CHANGED
|
@@ -66,6 +66,8 @@ export interface SdBuildPackageConfig {
|
|
|
66
66
|
publish?: SdPublishConfig;
|
|
67
67
|
/** glob patterns for files to copy from src/ to dist/ (relative path based on src/) */
|
|
68
68
|
copySrc?: string[];
|
|
69
|
+
/** watch hook configuration (when set, hook runs alongside build engine in watch mode) */
|
|
70
|
+
watch?: SdWatchHookConfig;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
/**
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular Build Adapter
|
|
3
|
+
*
|
|
4
|
+
* @angular/build/private API를 단일 모듈에 격리한다.
|
|
5
|
+
* Angular 버전 변경 시 이 파일만 수정하면 된다.
|
|
6
|
+
*/
|
|
7
|
+
import { consola } from "consola";
|
|
8
|
+
|
|
9
|
+
// ── Re-exports: Build ──
|
|
10
|
+
export { buildApplicationInternal } from "@angular/build/private";
|
|
11
|
+
export { ResultKind } from "@angular/build/private";
|
|
12
|
+
export type {
|
|
13
|
+
Result,
|
|
14
|
+
ResultFile,
|
|
15
|
+
ExternalResultMetadata,
|
|
16
|
+
} from "@angular/build/private";
|
|
17
|
+
|
|
18
|
+
// ── Re-exports: Dev Server ──
|
|
19
|
+
export { serveWithVite, normalizeDevServerOptions } from "@angular/build/private";
|
|
20
|
+
export type { NormalizedDevServerOptions } from "@angular/build/private";
|
|
21
|
+
|
|
22
|
+
// ── Re-exports: Public types ──
|
|
23
|
+
export type {
|
|
24
|
+
ApplicationBuilderOptions,
|
|
25
|
+
DevServerBuilderOptions,
|
|
26
|
+
BuildOutputFile,
|
|
27
|
+
BuildOutputFileType,
|
|
28
|
+
BuildOutputAsset,
|
|
29
|
+
DevServerBuilderOutput,
|
|
30
|
+
} from "@angular/build";
|
|
31
|
+
|
|
32
|
+
// ── Re-exports: IndexHtmlGenerator ──
|
|
33
|
+
export { IndexHtmlGenerator } from "@angular/build/private";
|
|
34
|
+
export type {
|
|
35
|
+
IndexHtmlGeneratorOptions,
|
|
36
|
+
IndexHtmlGeneratorProcessOptions,
|
|
37
|
+
IndexHtmlTransform,
|
|
38
|
+
} from "@angular/build/private";
|
|
39
|
+
|
|
40
|
+
// ── Re-exports: Angular Compiler (Library) ──
|
|
41
|
+
export { NgtscProgram, OptimizeFor } from "@angular/compiler-cli";
|
|
42
|
+
|
|
43
|
+
// ── Angular Library Host Extensions ──
|
|
44
|
+
// NgtscProgram은 ts.CompilerHost를 받지만, 아래 메서드가 있으면 duck-typing으로 호출한다.
|
|
45
|
+
// @angular/build/src/tools/angular/angular-host의 AngularCompilerHost에서 추출한 인터페이스.
|
|
46
|
+
// 내부 경로가 exports 필드에 의해 차단되므로 자체 정의한다.
|
|
47
|
+
|
|
48
|
+
export interface AngularLibraryHostExtensions {
|
|
49
|
+
/** 템플릿/스타일 파일을 읽는다 */
|
|
50
|
+
readResource(fileName: string): string | Promise<string>;
|
|
51
|
+
/** 인라인 스타일을 변환한다 (SCSS → CSS 등) */
|
|
52
|
+
transformResource(
|
|
53
|
+
data: string,
|
|
54
|
+
context: {
|
|
55
|
+
type: string;
|
|
56
|
+
containingFile: string;
|
|
57
|
+
resourceFile: string | null;
|
|
58
|
+
},
|
|
59
|
+
): Promise<{ content: string } | null>;
|
|
60
|
+
/** 변경된 리소스 파일 목록을 반환한다 (incremental compilation용) */
|
|
61
|
+
getModifiedResourceFiles?(): Set<string> | undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ── Re-exports: Utilities ──
|
|
65
|
+
export { checkPort, emitFilesToDisk } from "@angular/build/private";
|
|
66
|
+
|
|
67
|
+
// ── BuilderContext Factory ──
|
|
68
|
+
|
|
69
|
+
export interface AngularBuilderContextOptions {
|
|
70
|
+
workspaceRoot: string;
|
|
71
|
+
projectName: string;
|
|
72
|
+
/** 패키지 디렉토리 상대 경로 (workspaceRoot 기준) */
|
|
73
|
+
projectRoot: string;
|
|
74
|
+
/** 소스 디렉토리 (기본값: "src") */
|
|
75
|
+
sourceRoot?: string;
|
|
76
|
+
/** ApplicationBuilderOptions */
|
|
77
|
+
buildOptions: Record<string, unknown>;
|
|
78
|
+
signal?: AbortSignal;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const angularLogger = consola.withTag("sd:cli:angular");
|
|
82
|
+
|
|
83
|
+
type TeardownCallback = () => Promise<void> | void;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Angular CLI 없이 동작하는 BuilderContext를 생성한다.
|
|
87
|
+
* buildApplicationInternal()과 serveWithVite()가 실제 호출하는 필드만 구현한다.
|
|
88
|
+
*/
|
|
89
|
+
export function createAngularBuilderContext(options: AngularBuilderContextOptions) {
|
|
90
|
+
const teardowns: TeardownCallback[] = [];
|
|
91
|
+
|
|
92
|
+
const context = {
|
|
93
|
+
// ── Properties ──
|
|
94
|
+
workspaceRoot: options.workspaceRoot,
|
|
95
|
+
target: {
|
|
96
|
+
project: options.projectName,
|
|
97
|
+
target: "build",
|
|
98
|
+
configuration: "",
|
|
99
|
+
},
|
|
100
|
+
logger: {
|
|
101
|
+
info: (message: string) => angularLogger.info(message),
|
|
102
|
+
warn: (message: string) => angularLogger.warn(message),
|
|
103
|
+
error: (message: string) => angularLogger.error(message),
|
|
104
|
+
createChild: () => context.logger,
|
|
105
|
+
},
|
|
106
|
+
signal: options.signal,
|
|
107
|
+
|
|
108
|
+
// ── Methods (build) ──
|
|
109
|
+
addTeardown(fn: TeardownCallback) {
|
|
110
|
+
teardowns.push(fn);
|
|
111
|
+
},
|
|
112
|
+
getProjectMetadata(_projectName: string) {
|
|
113
|
+
return Promise.resolve({
|
|
114
|
+
root: options.projectRoot,
|
|
115
|
+
sourceRoot: options.sourceRoot ?? "src",
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
// ── Methods (dev server) ──
|
|
120
|
+
getTargetOptions(_target: unknown) {
|
|
121
|
+
return Promise.resolve(options.buildOptions);
|
|
122
|
+
},
|
|
123
|
+
getBuilderNameForTarget(_target: unknown) {
|
|
124
|
+
return Promise.resolve("@angular/build:application");
|
|
125
|
+
},
|
|
126
|
+
validateOptions<T = Record<string, unknown>>(
|
|
127
|
+
opts: Record<string, unknown>,
|
|
128
|
+
_builderName: string,
|
|
129
|
+
): Promise<T> {
|
|
130
|
+
return Promise.resolve(opts as T);
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
// ── Stub (미사용) ──
|
|
134
|
+
id: 0,
|
|
135
|
+
builder: { builderName: "@angular/build:application", description: "", optionSchema: {} },
|
|
136
|
+
currentDirectory: options.workspaceRoot,
|
|
137
|
+
scheduleTarget() {
|
|
138
|
+
return Promise.reject(new Error("Not supported: scheduleTarget"));
|
|
139
|
+
},
|
|
140
|
+
scheduleBuilder() {
|
|
141
|
+
return Promise.reject(new Error("Not supported: scheduleBuilder"));
|
|
142
|
+
},
|
|
143
|
+
reportRunning() {},
|
|
144
|
+
reportStatus() {},
|
|
145
|
+
reportProgress() {},
|
|
146
|
+
|
|
147
|
+
// ── Teardown 실행 ──
|
|
148
|
+
async disposeTeardowns() {
|
|
149
|
+
for (const fn of teardowns.reverse()) {
|
|
150
|
+
await fn();
|
|
151
|
+
}
|
|
152
|
+
teardowns.length = 0;
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return context;
|
|
157
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import os from "os";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Run task functions with limited concurrency.
|
|
5
|
+
* Uses a shared index pattern — each worker consumes the next available task.
|
|
6
|
+
*
|
|
7
|
+
* @param tasks Array of async task functions to execute
|
|
8
|
+
* @param concurrency Maximum number of tasks running simultaneously
|
|
9
|
+
* @returns Array of PromiseSettledResult in the same order as input tasks
|
|
10
|
+
*/
|
|
11
|
+
export async function runWithConcurrency<T>(
|
|
12
|
+
tasks: Array<() => Promise<T>>,
|
|
13
|
+
concurrency: number,
|
|
14
|
+
): Promise<PromiseSettledResult<T>[]> {
|
|
15
|
+
if (tasks.length === 0) return [];
|
|
16
|
+
|
|
17
|
+
const results: PromiseSettledResult<T>[] = new Array(tasks.length);
|
|
18
|
+
let index = 0;
|
|
19
|
+
|
|
20
|
+
async function worker(): Promise<void> {
|
|
21
|
+
while (index < tasks.length) {
|
|
22
|
+
const currentIndex = index++;
|
|
23
|
+
try {
|
|
24
|
+
const value = await tasks[currentIndex]();
|
|
25
|
+
results[currentIndex] = { status: "fulfilled", value };
|
|
26
|
+
} catch (reason) {
|
|
27
|
+
results[currentIndex] = { status: "rejected", reason };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const workerCount = Math.min(concurrency, tasks.length);
|
|
33
|
+
await Promise.all(Array.from({ length: workerCount }, () => worker()));
|
|
34
|
+
return results;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get max concurrency based on CPU cores.
|
|
39
|
+
* Uses 7/8 of available cores (minimum 1).
|
|
40
|
+
*/
|
|
41
|
+
export function getMaxConcurrency(): number {
|
|
42
|
+
return Math.max(Math.floor((os.cpus().length * 7) / 8), 1);
|
|
43
|
+
}
|
|
@@ -3,8 +3,6 @@ import { readFileSync, existsSync } from "fs";
|
|
|
3
3
|
import fs from "fs/promises";
|
|
4
4
|
import { createRequire } from "module";
|
|
5
5
|
import type esbuild from "esbuild";
|
|
6
|
-
import { solidPlugin } from "esbuild-plugin-solid";
|
|
7
|
-
import type { TypecheckEnv } from "./tsconfig";
|
|
8
6
|
import { consola } from "consola";
|
|
9
7
|
|
|
10
8
|
const logger = consola.withTag("sd:cli:esbuild-config");
|
|
@@ -45,18 +43,6 @@ export async function writeChangedOutputFiles(outputFiles: esbuild.OutputFile[])
|
|
|
45
43
|
return hasChanges;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
/**
|
|
49
|
-
* esbuild options for Library build
|
|
50
|
-
* - bundle: false (transpile individual files)
|
|
51
|
-
* - platform: node or browser depending on target
|
|
52
|
-
*/
|
|
53
|
-
export interface LibraryEsbuildOptions {
|
|
54
|
-
pkgDir: string;
|
|
55
|
-
entryPoints: string[];
|
|
56
|
-
target: "node" | "browser" | "neutral";
|
|
57
|
-
compilerOptions: Record<string, unknown>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
46
|
/**
|
|
61
47
|
* esbuild options for Server build
|
|
62
48
|
* - bundle: true (single bundle with all dependencies)
|
|
@@ -64,7 +50,6 @@ export interface LibraryEsbuildOptions {
|
|
|
64
50
|
export interface ServerEsbuildOptions {
|
|
65
51
|
pkgDir: string;
|
|
66
52
|
entryPoints: string[];
|
|
67
|
-
compilerOptions: Record<string, unknown>;
|
|
68
53
|
env?: Record<string, string>;
|
|
69
54
|
/** External modules to exclude from bundle */
|
|
70
55
|
external?: string[];
|
|
@@ -72,48 +57,6 @@ export interface ServerEsbuildOptions {
|
|
|
72
57
|
dev?: boolean;
|
|
73
58
|
}
|
|
74
59
|
|
|
75
|
-
/**
|
|
76
|
-
* Detect solid-js dependency in package.json
|
|
77
|
-
*/
|
|
78
|
-
function hasSolidDependency(pkgDir: string): boolean {
|
|
79
|
-
const pkgJson = JSON.parse(readFileSync(path.join(pkgDir, "package.json"), "utf-8")) as PkgJson;
|
|
80
|
-
const allDeps = { ...pkgJson.dependencies, ...pkgJson.peerDependencies };
|
|
81
|
-
return "solid-js" in allDeps;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Create esbuild config for Library build
|
|
86
|
-
*
|
|
87
|
-
* Used to build library packages with node/browser/neutral targets
|
|
88
|
-
* - bundle: false (transpile each file individually)
|
|
89
|
-
* - platform: node if target is node, otherwise browser
|
|
90
|
-
* - target: node20 if target is node, otherwise chrome84
|
|
91
|
-
*/
|
|
92
|
-
export function createLibraryEsbuildOptions(options: LibraryEsbuildOptions): esbuild.BuildOptions {
|
|
93
|
-
const plugins: esbuild.Plugin[] = [];
|
|
94
|
-
|
|
95
|
-
if (hasSolidDependency(options.pkgDir)) {
|
|
96
|
-
plugins.unshift(solidPlugin());
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
entryPoints: options.entryPoints,
|
|
101
|
-
outdir: path.join(options.pkgDir, "dist"),
|
|
102
|
-
format: "esm",
|
|
103
|
-
sourcemap: true,
|
|
104
|
-
sourcesContent: false,
|
|
105
|
-
platform: options.target === "node" ? "node" : "browser",
|
|
106
|
-
target: options.target === "node" ? "node20" : "chrome84",
|
|
107
|
-
bundle: false,
|
|
108
|
-
write: false,
|
|
109
|
-
tsconfigRaw: {
|
|
110
|
-
compilerOptions: toEsbuildTsconfigRaw(options.compilerOptions),
|
|
111
|
-
},
|
|
112
|
-
logLevel: "silent",
|
|
113
|
-
plugins,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
60
|
/**
|
|
118
61
|
* Create esbuild config for Server build
|
|
119
62
|
*
|
|
@@ -144,75 +87,11 @@ export function createServerEsbuildOptions(options: ServerEsbuildOptions): esbui
|
|
|
144
87
|
},
|
|
145
88
|
external: options.external,
|
|
146
89
|
define,
|
|
147
|
-
|
|
148
|
-
compilerOptions: toEsbuildTsconfigRaw(options.compilerOptions),
|
|
149
|
-
},
|
|
90
|
+
tsconfig: path.join(options.pkgDir, "tsconfig.json"),
|
|
150
91
|
logLevel: "silent",
|
|
151
92
|
};
|
|
152
93
|
}
|
|
153
94
|
|
|
154
|
-
// TypeScript ScriptTarget enum → esbuild target string
|
|
155
|
-
const TARGET_MAP: Record<number, string> = {
|
|
156
|
-
0: "es3", 1: "es5", 2: "es2015", 3: "es2016", 4: "es2017",
|
|
157
|
-
5: "es2018", 6: "es2019", 7: "es2020", 8: "es2021", 9: "es2022",
|
|
158
|
-
10: "es2023", 11: "es2024", 99: "esnext",
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
// TypeScript JsxEmit enum → esbuild jsx string
|
|
162
|
-
const JSX_MAP: Record<number, string> = {
|
|
163
|
-
1: "preserve", 2: "react", 3: "react-native", 4: "react-jsx", 5: "react-jsxdev",
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// TypeScript ModuleKind enum → string
|
|
167
|
-
const MODULE_MAP: Record<number, string> = {
|
|
168
|
-
0: "none", 1: "commonjs", 2: "amd", 3: "umd", 4: "system",
|
|
169
|
-
5: "es2015", 6: "es2020", 7: "es2022", 99: "esnext",
|
|
170
|
-
100: "node16", 199: "nodenext",
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
// TypeScript ModuleResolutionKind enum → string
|
|
174
|
-
const MODULE_RESOLUTION_MAP: Record<number, string> = {
|
|
175
|
-
1: "node10", 2: "node16", 3: "nodenext", 100: "bundler",
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Convert TypeScript's ts.CompilerOptions to esbuild-compatible tsconfigRaw compilerOptions.
|
|
180
|
-
*
|
|
181
|
-
* TypeScript uses numeric enum values (e.g., target: 99) while esbuild expects
|
|
182
|
-
* string values (e.g., "esnext"). This converts known enum fields and passes
|
|
183
|
-
* everything else through as-is.
|
|
184
|
-
*/
|
|
185
|
-
function toEsbuildTsconfigRaw(
|
|
186
|
-
compilerOptions: Record<string, unknown>,
|
|
187
|
-
): esbuild.TsconfigRaw["compilerOptions"] {
|
|
188
|
-
const result = { ...compilerOptions };
|
|
189
|
-
|
|
190
|
-
if (typeof result["target"] === "number") {
|
|
191
|
-
result["target"] = TARGET_MAP[result["target"]] ?? "esnext";
|
|
192
|
-
}
|
|
193
|
-
if (typeof result["jsx"] === "number") {
|
|
194
|
-
result["jsx"] = JSX_MAP[result["jsx"]];
|
|
195
|
-
}
|
|
196
|
-
if (typeof result["module"] === "number") {
|
|
197
|
-
result["module"] = MODULE_MAP[result["module"]];
|
|
198
|
-
}
|
|
199
|
-
if (typeof result["moduleResolution"] === "number") {
|
|
200
|
-
result["moduleResolution"] = MODULE_RESOLUTION_MAP[result["moduleResolution"]];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return result as esbuild.TsconfigRaw["compilerOptions"];
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Extract TypecheckEnv from build target
|
|
208
|
-
*
|
|
209
|
-
* Neutral is treated as browser for builds.
|
|
210
|
-
* (neutral packages are Node/browser universal, but we treat as browser for build)
|
|
211
|
-
*/
|
|
212
|
-
export function getTypecheckEnvFromTarget(target: "node" | "browser" | "neutral"): TypecheckEnv {
|
|
213
|
-
return target === "node" ? "node" : "browser";
|
|
214
|
-
}
|
|
215
|
-
|
|
216
95
|
//#region Optional Peer Deps
|
|
217
96
|
|
|
218
97
|
interface PkgJson {
|