@simplysm/sd-cli 12.16.24 → 13.0.0-beta.11
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/README.md +529 -0
- package/dist/builders/BaseBuilder.js +86 -0
- package/dist/builders/BaseBuilder.js.map +7 -0
- package/dist/builders/DtsBuilder.js +109 -0
- package/dist/builders/DtsBuilder.js.map +7 -0
- package/dist/builders/LibraryBuilder.js +122 -0
- package/dist/builders/LibraryBuilder.js.map +7 -0
- package/dist/builders/index.js +9 -0
- package/dist/builders/index.js.map +7 -0
- package/dist/builders/types.js +1 -0
- package/dist/builders/types.js.map +7 -0
- package/dist/capacitor/capacitor.js +619 -0
- package/dist/capacitor/capacitor.js.map +7 -0
- package/dist/commands/add-client.js +83 -0
- package/dist/commands/add-client.js.map +7 -0
- package/dist/commands/add-server.js +91 -0
- package/dist/commands/add-server.js.map +7 -0
- package/dist/commands/build.js +310 -0
- package/dist/commands/build.js.map +7 -0
- package/dist/commands/dev.js +426 -0
- package/dist/commands/dev.js.map +7 -0
- package/dist/commands/device.js +107 -0
- package/dist/commands/device.js.map +7 -0
- package/dist/commands/init.js +58 -0
- package/dist/commands/init.js.map +7 -0
- package/dist/commands/lint.js +138 -0
- package/dist/commands/lint.js.map +7 -0
- package/dist/commands/publish.js +401 -0
- package/dist/commands/publish.js.map +7 -0
- package/dist/commands/typecheck.js +197 -0
- package/dist/commands/typecheck.js.map +7 -0
- package/dist/commands/watch.js +19 -0
- package/dist/commands/watch.js.map +7 -0
- package/dist/core-common/src/common.types.d.ts +74 -0
- package/dist/core-common/src/common.types.d.ts.map +1 -0
- package/dist/core-common/src/env.d.ts +6 -0
- package/dist/core-common/src/env.d.ts.map +1 -0
- package/dist/core-common/src/errors/argument-error.d.ts +25 -0
- package/dist/core-common/src/errors/argument-error.d.ts.map +1 -0
- package/dist/core-common/src/errors/not-implemented-error.d.ts +29 -0
- package/dist/core-common/src/errors/not-implemented-error.d.ts.map +1 -0
- package/dist/core-common/src/errors/sd-error.d.ts +27 -0
- package/dist/core-common/src/errors/sd-error.d.ts.map +1 -0
- package/dist/core-common/src/errors/timeout-error.d.ts +31 -0
- package/dist/core-common/src/errors/timeout-error.d.ts.map +1 -0
- package/dist/core-common/src/extensions/arr-ext.d.ts +15 -0
- package/dist/core-common/src/extensions/arr-ext.d.ts.map +1 -0
- package/dist/core-common/src/extensions/arr-ext.helpers.d.ts +19 -0
- package/dist/core-common/src/extensions/arr-ext.helpers.d.ts.map +1 -0
- package/dist/core-common/src/extensions/arr-ext.types.d.ts +215 -0
- package/dist/core-common/src/extensions/arr-ext.types.d.ts.map +1 -0
- package/dist/core-common/src/extensions/map-ext.d.ts +57 -0
- package/dist/core-common/src/extensions/map-ext.d.ts.map +1 -0
- package/dist/core-common/src/extensions/set-ext.d.ts +36 -0
- package/dist/core-common/src/extensions/set-ext.d.ts.map +1 -0
- package/dist/core-common/src/features/debounce-queue.d.ts +53 -0
- package/dist/core-common/src/features/debounce-queue.d.ts.map +1 -0
- package/dist/core-common/src/features/event-emitter.d.ts +66 -0
- package/dist/core-common/src/features/event-emitter.d.ts.map +1 -0
- package/dist/core-common/src/features/serial-queue.d.ts +47 -0
- package/dist/core-common/src/features/serial-queue.d.ts.map +1 -0
- package/dist/core-common/src/index.d.ts +32 -0
- package/dist/core-common/src/index.d.ts.map +1 -0
- package/dist/core-common/src/types/date-only.d.ts +152 -0
- package/dist/core-common/src/types/date-only.d.ts.map +1 -0
- package/dist/core-common/src/types/date-time.d.ts +96 -0
- package/dist/core-common/src/types/date-time.d.ts.map +1 -0
- package/dist/core-common/src/types/lazy-gc-map.d.ts +80 -0
- package/dist/core-common/src/types/lazy-gc-map.d.ts.map +1 -0
- package/dist/core-common/src/types/time.d.ts +68 -0
- package/dist/core-common/src/types/time.d.ts.map +1 -0
- package/dist/core-common/src/types/uuid.d.ts +35 -0
- package/dist/core-common/src/types/uuid.d.ts.map +1 -0
- package/dist/core-common/src/utils/bytes.d.ts +51 -0
- package/dist/core-common/src/utils/bytes.d.ts.map +1 -0
- package/dist/core-common/src/utils/date-format.d.ts +90 -0
- package/dist/core-common/src/utils/date-format.d.ts.map +1 -0
- package/dist/core-common/src/utils/json.d.ts +34 -0
- package/dist/core-common/src/utils/json.d.ts.map +1 -0
- package/dist/core-common/src/utils/num.d.ts +60 -0
- package/dist/core-common/src/utils/num.d.ts.map +1 -0
- package/dist/core-common/src/utils/obj.d.ts +258 -0
- package/dist/core-common/src/utils/obj.d.ts.map +1 -0
- package/dist/core-common/src/utils/path.d.ts +23 -0
- package/dist/core-common/src/utils/path.d.ts.map +1 -0
- package/dist/core-common/src/utils/primitive.d.ts +18 -0
- package/dist/core-common/src/utils/primitive.d.ts.map +1 -0
- package/dist/core-common/src/utils/str.d.ts +103 -0
- package/dist/core-common/src/utils/str.d.ts.map +1 -0
- package/dist/core-common/src/utils/template-strings.d.ts +84 -0
- package/dist/core-common/src/utils/template-strings.d.ts.map +1 -0
- package/dist/core-common/src/utils/transferable.d.ts +47 -0
- package/dist/core-common/src/utils/transferable.d.ts.map +1 -0
- package/dist/core-common/src/utils/wait.d.ts +19 -0
- package/dist/core-common/src/utils/wait.d.ts.map +1 -0
- package/dist/core-common/src/utils/xml.d.ts +36 -0
- package/dist/core-common/src/utils/xml.d.ts.map +1 -0
- package/dist/core-common/src/zip/sd-zip.d.ts +80 -0
- package/dist/core-common/src/zip/sd-zip.d.ts.map +1 -0
- package/dist/core-node/src/features/fs-watcher.d.ts +70 -0
- package/dist/core-node/src/features/fs-watcher.d.ts.map +1 -0
- package/dist/core-node/src/index.d.ts +7 -0
- package/dist/core-node/src/index.d.ts.map +1 -0
- package/dist/core-node/src/utils/fs.d.ts +197 -0
- package/dist/core-node/src/utils/fs.d.ts.map +1 -0
- package/dist/core-node/src/utils/path.d.ts +75 -0
- package/dist/core-node/src/utils/path.d.ts.map +1 -0
- package/dist/core-node/src/worker/create-worker.d.ts +23 -0
- package/dist/core-node/src/worker/create-worker.d.ts.map +1 -0
- package/dist/core-node/src/worker/types.d.ts +67 -0
- package/dist/core-node/src/worker/types.d.ts.map +1 -0
- package/dist/core-node/src/worker/worker.d.ts +27 -0
- package/dist/core-node/src/worker/worker.d.ts.map +1 -0
- package/dist/electron/electron.js +242 -0
- package/dist/electron/electron.js.map +7 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +7 -0
- package/dist/infra/ResultCollector.js +59 -0
- package/dist/infra/ResultCollector.js.map +7 -0
- package/dist/infra/SignalHandler.js +44 -0
- package/dist/infra/SignalHandler.js.map +7 -0
- package/dist/infra/WorkerManager.js +56 -0
- package/dist/infra/WorkerManager.js.map +7 -0
- package/dist/infra/index.js +9 -0
- package/dist/infra/index.js.map +7 -0
- package/dist/orchestrators/WatchOrchestrator.js +135 -0
- package/dist/orchestrators/WatchOrchestrator.js.map +7 -0
- package/dist/orchestrators/index.js +5 -0
- package/dist/orchestrators/index.js.map +7 -0
- package/dist/sd-cli/src/builders/BaseBuilder.d.ts +77 -0
- package/dist/sd-cli/src/builders/BaseBuilder.d.ts.map +1 -0
- package/dist/sd-cli/src/builders/DtsBuilder.d.ts +22 -0
- package/dist/sd-cli/src/builders/DtsBuilder.d.ts.map +1 -0
- package/dist/sd-cli/src/builders/LibraryBuilder.d.ts +22 -0
- package/dist/sd-cli/src/builders/LibraryBuilder.d.ts.map +1 -0
- package/dist/sd-cli/src/builders/index.d.ts +5 -0
- package/dist/sd-cli/src/builders/index.d.ts.map +1 -0
- package/dist/sd-cli/src/builders/types.d.ts +49 -0
- package/dist/sd-cli/src/builders/types.d.ts.map +1 -0
- package/dist/sd-cli/src/capacitor/capacitor.d.ts +131 -0
- package/dist/sd-cli/src/capacitor/capacitor.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/add-client.d.ts +18 -0
- package/dist/sd-cli/src/commands/add-client.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/add-server.d.ts +18 -0
- package/dist/sd-cli/src/commands/add-server.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/build.d.ts +25 -0
- package/dist/sd-cli/src/commands/build.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/dev.d.ts +23 -0
- package/dist/sd-cli/src/commands/dev.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/device.d.ts +22 -0
- package/dist/sd-cli/src/commands/device.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/init.d.ts +15 -0
- package/dist/sd-cli/src/commands/init.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/lint.d.ts +31 -0
- package/dist/sd-cli/src/commands/lint.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/publish.d.ts +27 -0
- package/dist/sd-cli/src/commands/publish.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/typecheck.d.ts +39 -0
- package/dist/sd-cli/src/commands/typecheck.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/watch.d.ts +20 -0
- package/dist/sd-cli/src/commands/watch.d.ts.map +1 -0
- package/dist/sd-cli/src/electron/electron.d.ts +79 -0
- package/dist/sd-cli/src/electron/electron.d.ts.map +1 -0
- package/dist/sd-cli/src/index.d.ts +2 -0
- package/dist/sd-cli/src/index.d.ts.map +1 -0
- package/dist/sd-cli/src/infra/ResultCollector.d.ts +56 -0
- package/dist/sd-cli/src/infra/ResultCollector.d.ts.map +1 -0
- package/dist/sd-cli/src/infra/SignalHandler.d.ts +26 -0
- package/dist/sd-cli/src/infra/SignalHandler.d.ts.map +1 -0
- package/dist/sd-cli/src/infra/WorkerManager.d.ts +40 -0
- package/dist/sd-cli/src/infra/WorkerManager.d.ts.map +1 -0
- package/dist/sd-cli/src/infra/index.d.ts +4 -0
- package/dist/sd-cli/src/infra/index.d.ts.map +1 -0
- package/dist/sd-cli/src/orchestrators/WatchOrchestrator.d.ts +48 -0
- package/dist/sd-cli/src/orchestrators/WatchOrchestrator.d.ts.map +1 -0
- package/dist/sd-cli/src/orchestrators/index.d.ts +2 -0
- package/dist/sd-cli/src/orchestrators/index.d.ts.map +1 -0
- package/dist/sd-cli/src/sd-cli.d.ts +9 -0
- package/dist/sd-cli/src/sd-cli.d.ts.map +1 -0
- package/dist/sd-cli/src/sd-config.types.d.ts +222 -0
- package/dist/sd-cli/src/sd-config.types.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/build-env.d.ts +5 -0
- package/dist/sd-cli/src/utils/build-env.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/config-editor.d.ts +17 -0
- package/dist/sd-cli/src/utils/config-editor.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/esbuild-config.d.ts +49 -0
- package/dist/sd-cli/src/utils/esbuild-config.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/listr-manager.d.ts +37 -0
- package/dist/sd-cli/src/utils/listr-manager.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/output-utils.d.ts +21 -0
- package/dist/sd-cli/src/utils/output-utils.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/package-utils.d.ts +29 -0
- package/dist/sd-cli/src/utils/package-utils.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/sd-config.d.ts +12 -0
- package/dist/sd-cli/src/utils/sd-config.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/spawn.d.ts +26 -0
- package/dist/sd-cli/src/utils/spawn.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/tailwind-config-deps.d.ts +8 -0
- package/dist/sd-cli/src/utils/tailwind-config-deps.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/template.d.ts +14 -0
- package/dist/sd-cli/src/utils/template.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/tsconfig.d.ts +35 -0
- package/dist/sd-cli/src/utils/tsconfig.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/typecheck-serialization.d.ts +28 -0
- package/dist/sd-cli/src/utils/typecheck-serialization.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/vite-config.d.ts +25 -0
- package/dist/sd-cli/src/utils/vite-config.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/worker-events.d.ts +53 -0
- package/dist/sd-cli/src/utils/worker-events.d.ts.map +1 -0
- package/dist/sd-cli/src/workers/client.worker.d.ts +82 -0
- package/dist/sd-cli/src/workers/client.worker.d.ts.map +1 -0
- package/dist/sd-cli/src/workers/dts.worker.d.ts +73 -0
- package/dist/sd-cli/src/workers/dts.worker.d.ts.map +1 -0
- package/dist/sd-cli/src/workers/library.worker.d.ts +73 -0
- package/dist/sd-cli/src/workers/library.worker.d.ts.map +1 -0
- package/dist/sd-cli/src/workers/server-runtime.worker.d.ts +40 -0
- package/dist/sd-cli/src/workers/server-runtime.worker.d.ts.map +1 -0
- package/dist/sd-cli/src/workers/server.worker.d.ts +76 -0
- package/dist/sd-cli/src/workers/server.worker.d.ts.map +1 -0
- package/dist/sd-cli.js +239 -76
- package/dist/sd-cli.js.map +7 -0
- package/dist/sd-config.types.js +1 -0
- package/dist/sd-config.types.js.map +7 -0
- package/dist/storage/src/clients/ftp-storage-client.d.ts +56 -0
- package/dist/storage/src/clients/ftp-storage-client.d.ts.map +1 -0
- package/dist/storage/src/clients/sftp-storage-client.d.ts +48 -0
- package/dist/storage/src/clients/sftp-storage-client.d.ts.map +1 -0
- package/dist/storage/src/index.d.ts +7 -0
- package/dist/storage/src/index.d.ts.map +1 -0
- package/dist/storage/src/storage-factory.d.ts +20 -0
- package/dist/storage/src/storage-factory.d.ts.map +1 -0
- package/dist/storage/src/types/storage-conn-config.d.ts +7 -0
- package/dist/storage/src/types/storage-conn-config.d.ts.map +1 -0
- package/dist/storage/src/types/storage-type.d.ts +2 -0
- package/dist/storage/src/types/storage-type.d.ts.map +1 -0
- package/dist/storage/src/types/storage.d.ts +19 -0
- package/dist/storage/src/types/storage.d.ts.map +1 -0
- package/dist/utils/build-env.js +12 -0
- package/dist/utils/build-env.js.map +7 -0
- package/dist/utils/config-editor.js +77 -0
- package/dist/utils/config-editor.js.map +7 -0
- package/dist/utils/esbuild-config.js +44 -0
- package/dist/utils/esbuild-config.js.map +7 -0
- package/dist/utils/listr-manager.js +59 -0
- package/dist/utils/listr-manager.js.map +7 -0
- package/dist/utils/output-utils.js +40 -0
- package/dist/utils/output-utils.js.map +7 -0
- package/dist/utils/package-utils.js +28 -0
- package/dist/utils/package-utils.js.map +7 -0
- package/dist/utils/sd-config.js +24 -0
- package/dist/utils/sd-config.js.map +7 -0
- package/dist/utils/spawn.js +49 -0
- package/dist/utils/spawn.js.map +7 -0
- package/dist/utils/tailwind-config-deps.js +80 -0
- package/dist/utils/tailwind-config-deps.js.map +7 -0
- package/dist/utils/template.js +28 -0
- package/dist/utils/template.js.map +7 -0
- package/dist/utils/tsconfig.js +62 -0
- package/dist/utils/tsconfig.js.map +7 -0
- package/dist/utils/typecheck-serialization.js +46 -0
- package/dist/utils/typecheck-serialization.js.map +7 -0
- package/dist/utils/vite-config.js +108 -0
- package/dist/utils/vite-config.js.map +7 -0
- package/dist/utils/worker-events.js +38 -0
- package/dist/utils/worker-events.js.map +7 -0
- package/dist/workers/client.worker.js +94 -0
- package/dist/workers/client.worker.js.map +7 -0
- package/dist/workers/dts.worker.js +210 -0
- package/dist/workers/dts.worker.js.map +7 -0
- package/dist/workers/library.worker.js +118 -0
- package/dist/workers/library.worker.js.map +7 -0
- package/dist/workers/server-runtime.worker.js +85 -0
- package/dist/workers/server-runtime.worker.js.map +7 -0
- package/dist/workers/server.worker.js +114 -42
- package/dist/workers/server.worker.js.map +7 -0
- package/package.json +32 -29
- package/dist/entry/SdCliAiCommand.d.ts +0 -3
- package/dist/entry/SdCliAiCommand.js +0 -91
- package/dist/entry/SdCliCapacitor.d.ts +0 -35
- package/dist/entry/SdCliCapacitor.js +0 -565
- package/dist/entry/SdCliCordova.d.ts +0 -49
- package/dist/entry/SdCliCordova.js +0 -394
- package/dist/entry/SdCliElectron.d.ts +0 -22
- package/dist/entry/SdCliElectron.js +0 -128
- package/dist/entry/SdCliLocalUpdate.d.ts +0 -11
- package/dist/entry/SdCliLocalUpdate.js +0 -83
- package/dist/entry/SdCliPostInstall.d.ts +0 -3
- package/dist/entry/SdCliPostInstall.js +0 -48
- package/dist/entry/SdCliProject.d.ts +0 -24
- package/dist/entry/SdCliProject.js +0 -336
- package/dist/pkg-builders/SdBuildRunnerBase.d.ts +0 -14
- package/dist/pkg-builders/SdBuildRunnerBase.js +0 -22
- package/dist/pkg-builders/SdProjectBuildRunner.d.ts +0 -25
- package/dist/pkg-builders/SdProjectBuildRunner.js +0 -264
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.d.ts +0 -9
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js +0 -89
- package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +0 -10
- package/dist/pkg-builders/client/SdClientBuildRunner.js +0 -113
- package/dist/pkg-builders/client/SdNgBundler.d.ts +0 -38
- package/dist/pkg-builders/client/SdNgBundler.js +0 -525
- package/dist/pkg-builders/client/SdNgBundlerContext.d.ts +0 -25
- package/dist/pkg-builders/client/SdNgBundlerContext.js +0 -104
- package/dist/pkg-builders/client/createSdNgPlugin.d.ts +0 -5
- package/dist/pkg-builders/client/createSdNgPlugin.js +0 -133
- package/dist/pkg-builders/commons/SdWorkerPathPlugin.d.ts +0 -2
- package/dist/pkg-builders/commons/SdWorkerPathPlugin.js +0 -91
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.d.ts +0 -9
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.js +0 -138
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.d.ts +0 -11
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js +0 -79
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +0 -8
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js +0 -44
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +0 -8
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +0 -34
- package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +0 -10
- package/dist/pkg-builders/lib/SdTsLibBuilder.js +0 -54
- package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +0 -10
- package/dist/pkg-builders/server/SdServerBuildRunner.js +0 -228
- package/dist/pkg-builders/server/SdServerBundler.d.ts +0 -17
- package/dist/pkg-builders/server/SdServerBundler.js +0 -174
- package/dist/pkg-builders/server/createSdServerPlugin.d.ts +0 -5
- package/dist/pkg-builders/server/createSdServerPlugin.js +0 -53
- package/dist/sd-cli-entry.d.ts +0 -2
- package/dist/sd-cli-entry.js +0 -230
- package/dist/sd-cli.d.ts +0 -2
- package/dist/ts-compiler/ScopePathSet.d.ts +0 -7
- package/dist/ts-compiler/ScopePathSet.js +0 -12
- package/dist/ts-compiler/SdDepAnalyzer.d.ts +0 -15
- package/dist/ts-compiler/SdDepAnalyzer.js +0 -299
- package/dist/ts-compiler/SdDepCache.d.ts +0 -77
- package/dist/ts-compiler/SdDepCache.js +0 -248
- package/dist/ts-compiler/SdStyleBundler.d.ts +0 -23
- package/dist/ts-compiler/SdStyleBundler.js +0 -131
- package/dist/ts-compiler/SdTsCompiler.d.ts +0 -29
- package/dist/ts-compiler/SdTsCompiler.js +0 -420
- package/dist/types/build/ISdBuildMessage.d.ts +0 -10
- package/dist/types/build/ISdBuildMessage.js +0 -1
- package/dist/types/build/ISdBuildResult.d.ts +0 -8
- package/dist/types/build/ISdBuildResult.js +0 -1
- package/dist/types/build/ISdTsCompilerOptions.d.ts +0 -10
- package/dist/types/build/ISdTsCompilerOptions.js +0 -1
- package/dist/types/build/ISdTsCompilerResult.d.ts +0 -14
- package/dist/types/build/ISdTsCompilerResult.js +0 -1
- package/dist/types/build/TStylesheetBundlingResult.d.ts +0 -12
- package/dist/types/build/TStylesheetBundlingResult.js +0 -1
- package/dist/types/common-config/INpmConfig.d.ts +0 -17
- package/dist/types/common-config/INpmConfig.js +0 -1
- package/dist/types/common-config/ITsConfig.d.ts +0 -7
- package/dist/types/common-config/ITsConfig.js +0 -1
- package/dist/types/config/ISdProjectConfig.d.ts +0 -144
- package/dist/types/config/ISdProjectConfig.js +0 -1
- package/dist/types/plugin/ISdCliNgPluginResultCache.d.ts +0 -8
- package/dist/types/plugin/ISdCliNgPluginResultCache.js +0 -1
- package/dist/types/plugin/ISdCliServerPluginResultCache.d.ts +0 -8
- package/dist/types/plugin/ISdCliServerPluginResultCache.js +0 -1
- package/dist/types/worker/ISdBuildRunnerWorkerType.d.ts +0 -20
- package/dist/types/worker/ISdBuildRunnerWorkerType.js +0 -1
- package/dist/types/worker/IServerWorkerType.d.ts +0 -17
- package/dist/types/worker/IServerWorkerType.js +0 -1
- package/dist/utils/SdCliConvertMessageUtils.d.ts +0 -21
- package/dist/utils/SdCliConvertMessageUtils.js +0 -138
- package/dist/utils/SdCliPerformanceTimer.d.ts +0 -10
- package/dist/utils/SdCliPerformanceTimer.js +0 -50
- package/dist/utils/loadProjConfAsync.d.ts +0 -5
- package/dist/utils/loadProjConfAsync.js +0 -7
- package/dist/workers/build-runner.worker.d.ts +0 -1
- package/dist/workers/build-runner.worker.js +0 -37
- package/dist/workers/server.worker.d.ts +0 -1
- package/lib/cordova-entry.js +0 -29
- package/src/entry/SdCliAiCommand.ts +0 -105
- package/src/entry/SdCliCapacitor.ts +0 -760
- package/src/entry/SdCliCordova.ts +0 -550
- package/src/entry/SdCliElectron.ts +0 -197
- package/src/entry/SdCliLocalUpdate.ts +0 -106
- package/src/entry/SdCliPostInstall.ts +0 -51
- package/src/entry/SdCliProject.ts +0 -427
- package/src/pkg-builders/SdBuildRunnerBase.ts +0 -36
- package/src/pkg-builders/SdProjectBuildRunner.ts +0 -398
- package/src/pkg-builders/client/SdCliNgRoutesFileGenerator.ts +0 -112
- package/src/pkg-builders/client/SdClientBuildRunner.ts +0 -156
- package/src/pkg-builders/client/SdNgBundler.ts +0 -666
- package/src/pkg-builders/client/SdNgBundlerContext.ts +0 -138
- package/src/pkg-builders/client/createSdNgPlugin.ts +0 -186
- package/src/pkg-builders/commons/SdWorkerPathPlugin.ts +0 -117
- package/src/pkg-builders/lib/SdCliDbContextFileGenerator.ts +0 -177
- package/src/pkg-builders/lib/SdCliIndexFileGenerator.ts +0 -94
- package/src/pkg-builders/lib/SdJsLibBuildRunner.ts +0 -59
- package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +0 -47
- package/src/pkg-builders/lib/SdTsLibBuilder.ts +0 -71
- package/src/pkg-builders/server/SdServerBuildRunner.ts +0 -299
- package/src/pkg-builders/server/SdServerBundler.ts +0 -208
- package/src/pkg-builders/server/createSdServerPlugin.ts +0 -80
- package/src/sd-cli-entry.ts +0 -292
- package/src/sd-cli.ts +0 -105
- package/src/ts-compiler/ScopePathSet.ts +0 -17
- package/src/ts-compiler/SdDepAnalyzer.ts +0 -372
- package/src/ts-compiler/SdDepCache.ts +0 -304
- package/src/ts-compiler/SdStyleBundler.ts +0 -169
- package/src/ts-compiler/SdTsCompiler.ts +0 -638
- package/src/types/build/ISdBuildMessage.ts +0 -11
- package/src/types/build/ISdBuildResult.ts +0 -9
- package/src/types/build/ISdTsCompilerOptions.ts +0 -11
- package/src/types/build/ISdTsCompilerResult.ts +0 -12
- package/src/types/build/TStylesheetBundlingResult.ts +0 -15
- package/src/types/common-config/INpmConfig.ts +0 -24
- package/src/types/common-config/ITsConfig.ts +0 -5
- package/src/types/config/ISdProjectConfig.ts +0 -174
- package/src/types/plugin/ISdCliNgPluginResultCache.ts +0 -9
- package/src/types/plugin/ISdCliServerPluginResultCache.ts +0 -9
- package/src/types/worker/ISdBuildRunnerWorkerType.ts +0 -19
- package/src/types/worker/IServerWorkerType.ts +0 -8
- package/src/utils/SdCliConvertMessageUtils.ts +0 -180
- package/src/utils/SdCliPerformanceTimer.ts +0 -62
- package/src/utils/loadProjConfAsync.ts +0 -16
- package/src/workers/build-runner.worker.ts +0 -54
- package/src/workers/server.worker.ts +0 -54
- package/tests/deps/sd-dependency-analyzer.spec.ts +0 -241
- package/tests/deps/sd-dependency-cache.spec.ts +0 -153
- package/tsconfig.json +0 -8
- package/tsconfig.test.json +0 -8
- package/vitest.config.js +0 -15
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { SdLogger } from "@simplysm/sd-core-node";
|
|
4
|
-
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
5
|
-
|
|
6
|
-
// import { InitialFileRecord } from "@angular/build/src/tools/esbuild/bundler-context";
|
|
7
|
-
|
|
8
|
-
interface InitialFileRecord {
|
|
9
|
-
entrypoint: boolean;
|
|
10
|
-
name?: string;
|
|
11
|
-
type: "script" | "style";
|
|
12
|
-
external?: boolean;
|
|
13
|
-
serverFile: boolean;
|
|
14
|
-
depth: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class SdNgBundlerContext {
|
|
18
|
-
private readonly _logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundlerContext"]);
|
|
19
|
-
|
|
20
|
-
private _context?: esbuild.BuildContext;
|
|
21
|
-
|
|
22
|
-
constructor(
|
|
23
|
-
private readonly _pkgPath: string,
|
|
24
|
-
private readonly _watch: boolean,
|
|
25
|
-
private readonly _esbuildOptions: esbuild.BuildOptions,
|
|
26
|
-
) {}
|
|
27
|
-
|
|
28
|
-
async bundleAsync() {
|
|
29
|
-
let esbuildResult: esbuild.BuildResult;
|
|
30
|
-
|
|
31
|
-
this._debug(`Building...`);
|
|
32
|
-
if (this._watch) {
|
|
33
|
-
if (this._context == null) {
|
|
34
|
-
this._context = await esbuild.context(this._esbuildOptions);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
esbuildResult = await this._context.rebuild();
|
|
39
|
-
} catch (err) {
|
|
40
|
-
if ("warnings" in err || "errors" in err) {
|
|
41
|
-
esbuildResult = err;
|
|
42
|
-
} else {
|
|
43
|
-
throw err;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
try {
|
|
48
|
-
esbuildResult = await esbuild.build(this._esbuildOptions);
|
|
49
|
-
} catch (err) {
|
|
50
|
-
if ("warnings" in err || "errors" in err) {
|
|
51
|
-
esbuildResult = err;
|
|
52
|
-
} else {
|
|
53
|
-
throw err;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
this._debug(`Build completed`);
|
|
58
|
-
|
|
59
|
-
this._debug(`Converting results...`);
|
|
60
|
-
const results = SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(
|
|
61
|
-
esbuildResult,
|
|
62
|
-
this._pkgPath,
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const initialFiles = new Map<string, InitialFileRecord>();
|
|
66
|
-
|
|
67
|
-
for (const outputFile of esbuildResult.outputFiles ?? []) {
|
|
68
|
-
const relativeFilePath = path.isAbsolute(outputFile.path)
|
|
69
|
-
? path.relative(this._pkgPath, outputFile.path)
|
|
70
|
-
: outputFile.path;
|
|
71
|
-
const entryPoint = esbuildResult.metafile?.outputs[relativeFilePath]?.entryPoint;
|
|
72
|
-
|
|
73
|
-
outputFile.path = relativeFilePath;
|
|
74
|
-
|
|
75
|
-
if (entryPoint != null) {
|
|
76
|
-
const name = path.basename(relativeFilePath).split(".", 1)[0];
|
|
77
|
-
const type = path.extname(relativeFilePath) === ".css" ? "style" : "script";
|
|
78
|
-
|
|
79
|
-
if (this._esbuildOptions.entryPoints?.[name] != null) {
|
|
80
|
-
initialFiles.set(relativeFilePath, {
|
|
81
|
-
name,
|
|
82
|
-
type,
|
|
83
|
-
entrypoint: true,
|
|
84
|
-
serverFile: false,
|
|
85
|
-
depth: 0,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const files = [...initialFiles.keys()];
|
|
92
|
-
for (const file of files) {
|
|
93
|
-
const entryRecord = initialFiles.get(file)!;
|
|
94
|
-
|
|
95
|
-
for (const initialImport of esbuildResult.metafile?.outputs[file]?.imports ?? []) {
|
|
96
|
-
const existingRecord = initialFiles.get(initialImport.path);
|
|
97
|
-
if (existingRecord) {
|
|
98
|
-
if (existingRecord.depth > entryRecord.depth + 1) {
|
|
99
|
-
existingRecord.depth = entryRecord.depth + 1;
|
|
100
|
-
}
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (initialImport.kind === "import-statement" || initialImport.kind === "import-rule") {
|
|
105
|
-
const record: InitialFileRecord = {
|
|
106
|
-
type: initialImport.kind === "import-rule" ? "style" : "script",
|
|
107
|
-
entrypoint: false,
|
|
108
|
-
external: initialImport.external,
|
|
109
|
-
serverFile: false,
|
|
110
|
-
depth: entryRecord.depth + 1,
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
initialFiles.set(initialImport.path, record);
|
|
114
|
-
|
|
115
|
-
if (!initialImport.external) {
|
|
116
|
-
files.push(initialImport.path);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
results,
|
|
124
|
-
initialFiles,
|
|
125
|
-
outputFiles: esbuildResult.outputFiles,
|
|
126
|
-
metafile: esbuildResult.metafile,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private _debug(...msg: any[]): void {
|
|
131
|
-
this._logger.debug(
|
|
132
|
-
`[${path.basename(this._pkgPath)}] (${Object.keys(
|
|
133
|
-
this._esbuildOptions.entryPoints as Record<string, any>,
|
|
134
|
-
).join(", ")})`,
|
|
135
|
-
...msg,
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import os from "os";
|
|
4
|
-
import { JavaScriptTransformer } from "@angular/build/src/tools/esbuild/javascript-transformer";
|
|
5
|
-
import { FsUtils, PathUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
6
|
-
import { SdCliPerformanceTimer } from "../../utils/SdCliPerformanceTimer";
|
|
7
|
-
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
8
|
-
import { SdTsCompiler } from "../../ts-compiler/SdTsCompiler";
|
|
9
|
-
import { ISdCliNgPluginResultCache } from "../../types/plugin/ISdCliNgPluginResultCache";
|
|
10
|
-
import { ISdTsCompilerResult } from "../../types/build/ISdTsCompilerResult";
|
|
11
|
-
import { ISdTsCompilerOptions } from "../../types/build/ISdTsCompilerOptions";
|
|
12
|
-
|
|
13
|
-
export function createSdNgPlugin(
|
|
14
|
-
opt: ISdTsCompilerOptions,
|
|
15
|
-
modifiedFileSet: Set<TNormPath>,
|
|
16
|
-
resultCache: ISdCliNgPluginResultCache,
|
|
17
|
-
): esbuild.Plugin {
|
|
18
|
-
let perf: SdCliPerformanceTimer;
|
|
19
|
-
const logger = SdLogger.get(["simplysm", "sd-cli", "createSdNgPlugin"]);
|
|
20
|
-
|
|
21
|
-
const debug = (...msg: any[]) => {
|
|
22
|
-
logger.debug(`[${path.basename(opt.pkgPath)}]`, ...msg);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
name: "sd-ng-plugin",
|
|
27
|
-
setup: (build: esbuild.PluginBuild) => {
|
|
28
|
-
const tsCompiler = new SdTsCompiler(opt, true);
|
|
29
|
-
|
|
30
|
-
let tsCompileResult: ISdTsCompilerResult;
|
|
31
|
-
const outputContentsCacheMap = new Map<TNormPath, Uint8Array>();
|
|
32
|
-
|
|
33
|
-
//-- js babel transformer
|
|
34
|
-
const javascriptTransformer = new JavaScriptTransformer(
|
|
35
|
-
{
|
|
36
|
-
thirdPartySourcemaps: !!opt.watch?.dev,
|
|
37
|
-
sourcemap: !!opt.watch?.dev,
|
|
38
|
-
jit: false,
|
|
39
|
-
advancedOptimizations: !opt.watch?.dev,
|
|
40
|
-
},
|
|
41
|
-
Math.floor((os.cpus().length * 2) / 3),
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
//---------------------------
|
|
45
|
-
|
|
46
|
-
build.onStart(async () => {
|
|
47
|
-
perf = new SdCliPerformanceTimer("esbuild");
|
|
48
|
-
|
|
49
|
-
const res = await perf.run("typescript build", async () => {
|
|
50
|
-
for (const modifiedFile of modifiedFileSet) {
|
|
51
|
-
outputContentsCacheMap.delete(modifiedFile);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
tsCompileResult = await tsCompiler.compileAsync(modifiedFileSet);
|
|
55
|
-
|
|
56
|
-
resultCache.watchFileSet = tsCompileResult.watchFileSet;
|
|
57
|
-
resultCache.affectedFileSet = tsCompileResult.affectedFileSet;
|
|
58
|
-
|
|
59
|
-
const tsEsbuildResult = SdCliConvertMessageUtils.convertToEsbuildFromBuildMessages(
|
|
60
|
-
tsCompileResult.messages,
|
|
61
|
-
opt.pkgPath,
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
//-- return err/warn
|
|
65
|
-
return {
|
|
66
|
-
errors: [
|
|
67
|
-
...tsEsbuildResult.errors,
|
|
68
|
-
...Array.from(tsCompileResult.stylesheetBundlingResultMap.values())
|
|
69
|
-
.flatMap((item) => item.errors)
|
|
70
|
-
.filterExists(),
|
|
71
|
-
].filterExists(),
|
|
72
|
-
warnings: [
|
|
73
|
-
...tsEsbuildResult.warnings,
|
|
74
|
-
...Array.from(tsCompileResult.stylesheetBundlingResultMap.values())
|
|
75
|
-
.flatMap((item) => item.warnings)
|
|
76
|
-
.filterExists(),
|
|
77
|
-
],
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
perf.start("esbuild transform & bundling");
|
|
82
|
-
return res;
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
build.onLoad({ filter: /\.ts$/ }, async (args) => {
|
|
86
|
-
const emittedFiles = tsCompileResult.emittedFilesCacheMap.get(PathUtils.norm(args.path));
|
|
87
|
-
|
|
88
|
-
const output = outputContentsCacheMap.get(PathUtils.norm(args.path));
|
|
89
|
-
if (output != null) {
|
|
90
|
-
return { contents: output, loader: "js" };
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const contents = emittedFiles?.last()?.text ?? "";
|
|
94
|
-
|
|
95
|
-
const { sideEffects } = await build.resolve(args.path, {
|
|
96
|
-
kind: "import-statement",
|
|
97
|
-
resolveDir: build.initialOptions.absWorkingDir ?? "",
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const newContents = await perf.run("esbuild transform:js:*.ts", async () => {
|
|
101
|
-
return await javascriptTransformer.transformData(args.path, contents, true, sideEffects);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
outputContentsCacheMap.set(PathUtils.norm(args.path), newContents);
|
|
105
|
-
|
|
106
|
-
return { contents: newContents, loader: "js" };
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
build.onLoad({ filter: /\.mjs$/ }, async (args) => {
|
|
110
|
-
resultCache.watchFileSet!.add(PathUtils.norm(args.path));
|
|
111
|
-
|
|
112
|
-
const output = outputContentsCacheMap.get(PathUtils.norm(args.path));
|
|
113
|
-
if (output != null) {
|
|
114
|
-
return { contents: output, loader: "js" };
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const { sideEffects } = await build.resolve(args.path, {
|
|
118
|
-
kind: "import-statement",
|
|
119
|
-
resolveDir: build.initialOptions.absWorkingDir ?? "",
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
try {
|
|
123
|
-
const newContents = await perf.run("esbuild transform:js:*.js", async () => {
|
|
124
|
-
const contents = await FsUtils.readFileBufferAsync(args.path);
|
|
125
|
-
|
|
126
|
-
return await javascriptTransformer.transformData(
|
|
127
|
-
args.path,
|
|
128
|
-
contents.toString(),
|
|
129
|
-
false,
|
|
130
|
-
sideEffects,
|
|
131
|
-
);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
outputContentsCacheMap.set(PathUtils.norm(args.path), newContents);
|
|
135
|
-
|
|
136
|
-
return {
|
|
137
|
-
contents: newContents,
|
|
138
|
-
loader: "js",
|
|
139
|
-
};
|
|
140
|
-
} catch (err) {
|
|
141
|
-
return { errors: [{ text: err?.message ?? String(err) }] };
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
const otherLoaderFilter = new RegExp(
|
|
146
|
-
"(" +
|
|
147
|
-
Object.keys(build.initialOptions.loader ?? {})
|
|
148
|
-
.map((ext) => "\\" + ext)
|
|
149
|
-
.join("|") +
|
|
150
|
-
")$",
|
|
151
|
-
);
|
|
152
|
-
build.onLoad({ filter: otherLoaderFilter }, (args) => {
|
|
153
|
-
resultCache.watchFileSet!.add(PathUtils.norm(args.path));
|
|
154
|
-
return null;
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
build.onEnd((result) => {
|
|
158
|
-
perf.end("esbuild transform & bundling");
|
|
159
|
-
debug(perf.toString());
|
|
160
|
-
|
|
161
|
-
for (const stylesheetBundlingResult of tsCompileResult.stylesheetBundlingResultMap.values()) {
|
|
162
|
-
if ("outputFiles" in stylesheetBundlingResult) {
|
|
163
|
-
result.outputFiles ??= [];
|
|
164
|
-
result.outputFiles.push(...stylesheetBundlingResult.outputFiles);
|
|
165
|
-
|
|
166
|
-
if (result.metafile) {
|
|
167
|
-
result.metafile.inputs = {
|
|
168
|
-
...result.metafile.inputs,
|
|
169
|
-
...stylesheetBundlingResult.metafile.inputs,
|
|
170
|
-
};
|
|
171
|
-
result.metafile.outputs = {
|
|
172
|
-
...result.metafile.outputs,
|
|
173
|
-
...stylesheetBundlingResult.metafile.outputs,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
resultCache.outputFiles = result.outputFiles;
|
|
180
|
-
resultCache.metafile = result.metafile;
|
|
181
|
-
|
|
182
|
-
modifiedFileSet.clear();
|
|
183
|
-
});
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { FsUtils, HashUtils } from "@simplysm/sd-core-node";
|
|
4
|
-
|
|
5
|
-
export function SdWorkerPathPlugin(outdir: string): esbuild.Plugin {
|
|
6
|
-
return {
|
|
7
|
-
name: "sd-worker-path-plugin",
|
|
8
|
-
setup(build) {
|
|
9
|
-
build.onLoad({ filter: /\.[cm]?[jt]s$/ }, async (args) => {
|
|
10
|
-
const originalSource = await FsUtils.readFileAsync(args.path);
|
|
11
|
-
|
|
12
|
-
// 정규식: import.meta.resolve('...') 또는 "..." 캡쳐
|
|
13
|
-
// 워커 파일뿐만 아니라 필요한 모든 리소스를 처리할 수 있지만, 일단 worker만 타겟팅
|
|
14
|
-
const regex = /import\.meta\.resolve\(\s*(['"])([^'"]+?\.worker)(?:\.[a-z]+)?\1\s*\)/g;
|
|
15
|
-
|
|
16
|
-
if (!regex.test(originalSource)) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// 매칭되는 모든 import.meta.resolve를 찾아서 처리
|
|
21
|
-
const newSource = await replaceAsync(
|
|
22
|
-
originalSource,
|
|
23
|
-
regex,
|
|
24
|
-
async (match, quote, relPath) => {
|
|
25
|
-
// 1. 실제 워커 파일 경로 계산
|
|
26
|
-
const workerSourcePath = path.resolve(path.dirname(args.path), relPath);
|
|
27
|
-
|
|
28
|
-
// 확장자가 없을 경우 자동 탐색 (js, ts 등)
|
|
29
|
-
const resolvedWorkerPath = resolveFile(workerSourcePath);
|
|
30
|
-
if (resolvedWorkerPath == null) {
|
|
31
|
-
// 파일이 없으면 건드리지 않음 (런타임 에러로 넘김)
|
|
32
|
-
return match;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// 2. 출력될 워커 파일명 결정 (캐싱 및 중복 방지를 위해 해시 사용 권장)
|
|
36
|
-
const fileContent = await FsUtils.readFileBufferAsync(resolvedWorkerPath);
|
|
37
|
-
const hash = HashUtils.get(fileContent).substring(0, 8);
|
|
38
|
-
const workerBaseName = path.basename(
|
|
39
|
-
resolvedWorkerPath,
|
|
40
|
-
path.extname(resolvedWorkerPath),
|
|
41
|
-
);
|
|
42
|
-
const outputFileName = `${workerBaseName}-${hash}.js`;
|
|
43
|
-
const outputFilePath = path.join(outdir, "workers", outputFileName);
|
|
44
|
-
|
|
45
|
-
// 3. 워커 파일 빌드 (존재하지 않거나 변경되었을 때만)
|
|
46
|
-
// (간단하게 하기 위해 매번 빌드 시도하거나, 해시로 체크 가능. 여기선 esbuild 증분 빌드에 맡김)
|
|
47
|
-
// *중요*: 워커도 번들링해야 함.
|
|
48
|
-
await esbuild.build({
|
|
49
|
-
...build.initialOptions,
|
|
50
|
-
plugins:
|
|
51
|
-
build.initialOptions.plugins?.filter(
|
|
52
|
-
(item) =>
|
|
53
|
-
item.name !== "sd-worker-path-plugin" &&
|
|
54
|
-
item.name !== "sd-ng-plugin" &&
|
|
55
|
-
item.name !== "sd-server-plugin",
|
|
56
|
-
) ?? [],
|
|
57
|
-
outdir: undefined,
|
|
58
|
-
|
|
59
|
-
entryPoints: [resolvedWorkerPath],
|
|
60
|
-
bundle: true,
|
|
61
|
-
write: true,
|
|
62
|
-
splitting: false,
|
|
63
|
-
outfile: outputFilePath,
|
|
64
|
-
// platform: build.initialOptions.platform,
|
|
65
|
-
// target: build.initialOptions.target,
|
|
66
|
-
// format: build.initialOptions.format,
|
|
67
|
-
// minify: build.initialOptions.minify,
|
|
68
|
-
// banner: build.initialOptions.banner,
|
|
69
|
-
// sourcemap: build.initialOptions.sourcemap,
|
|
70
|
-
// external: build.initialOptions.external, // 외부 의존성 설정 상속
|
|
71
|
-
// 플러그인 상속 주의: 무한 루프 방지를 위해 이 플러그인은 제외해야 함
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// 4. 경로 치환
|
|
75
|
-
// 번들링된 메인 파일(dist/main.js) 기준으로 workers 폴더는 ./workers/ 임
|
|
76
|
-
return `import.meta.resolve(${quote}./workers/${outputFileName}${quote})`;
|
|
77
|
-
},
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
contents: newSource,
|
|
82
|
-
loader: "ts", // 또는 js, 파일 확장자에 따라 다르게 처리 가능하나 보통 ts로 넘겨도 됨
|
|
83
|
-
// 워커 파일이 변경되면 이 파일도 다시 빌드되어야 함을 알림
|
|
84
|
-
// (정확히 하려면 워커의 의존성까지 다 넣어야 하지만, 최소한 워커 엔트리는 넣음)
|
|
85
|
-
// watchFiles: ... (esbuild가 내부적으로 처리해주길 기대)
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// 정규식 비동기 replace 헬퍼
|
|
93
|
-
async function replaceAsync(
|
|
94
|
-
str: string,
|
|
95
|
-
regex: RegExp,
|
|
96
|
-
asyncFn: (match: string, ...args: any[]) => Promise<string>,
|
|
97
|
-
) {
|
|
98
|
-
const promises: Promise<string>[] = [];
|
|
99
|
-
str.replace(regex, (match, ...args) => {
|
|
100
|
-
promises.push(asyncFn(match, ...args));
|
|
101
|
-
return match;
|
|
102
|
-
});
|
|
103
|
-
const data = await Promise.all(promises);
|
|
104
|
-
return str.replace(regex, () => data.shift()!);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// 파일 확장자 찾기 헬퍼
|
|
108
|
-
function resolveFile(filePathWithoutExt: string): string | undefined {
|
|
109
|
-
if (FsUtils.exists(filePathWithoutExt)) return filePathWithoutExt;
|
|
110
|
-
|
|
111
|
-
const exts = [".ts", ".js", ".mjs", ".cjs"];
|
|
112
|
-
for (const ext of exts) {
|
|
113
|
-
const p = filePathWithoutExt + ext;
|
|
114
|
-
if (FsUtils.exists(p)) return p;
|
|
115
|
-
}
|
|
116
|
-
return undefined;
|
|
117
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { FsUtils, HashUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { StringUtils } from "@simplysm/sd-core-common";
|
|
4
|
-
import { INpmConfig } from "../../types/common-config/INpmConfig";
|
|
5
|
-
|
|
6
|
-
export class SdCliDbContextFileGenerator {
|
|
7
|
-
cachedHash?: string;
|
|
8
|
-
|
|
9
|
-
async watchAsync(pkgPath: string, kebabName: string) {
|
|
10
|
-
const targetFilePath = path.resolve(pkgPath, `src/${kebabName}.ts`);
|
|
11
|
-
this.cachedHash = FsUtils.exists(targetFilePath)
|
|
12
|
-
? HashUtils.get(await FsUtils.readFileAsync(targetFilePath))
|
|
13
|
-
: undefined;
|
|
14
|
-
|
|
15
|
-
const watcher = await SdFsWatcher.watchAsync([path.resolve(pkgPath, "src")], {
|
|
16
|
-
ignored: [targetFilePath],
|
|
17
|
-
});
|
|
18
|
-
watcher.onChange({ delay: 50 }, async (changeInfos) => {
|
|
19
|
-
if (changeInfos.some((item) => ["add", "addDir", "unlink", "unlinkDir"].includes(item.event)))
|
|
20
|
-
await this.runAsync(pkgPath, kebabName);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
await this.runAsync(pkgPath, kebabName);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async runAsync(
|
|
27
|
-
pkgPath: string,
|
|
28
|
-
kebabName: string,
|
|
29
|
-
): Promise<{ changed: boolean; filePath: string; content: string }> {
|
|
30
|
-
const npmConfig = (await FsUtils.readJsonAsync(
|
|
31
|
-
path.resolve(pkgPath, "package.json"),
|
|
32
|
-
)) as INpmConfig;
|
|
33
|
-
const useExt = npmConfig.dependencies?.["@simplysm/sd-orm-common-ext"] != null;
|
|
34
|
-
|
|
35
|
-
const targetFilePath = path.resolve(pkgPath, `src/${kebabName}.ts`);
|
|
36
|
-
|
|
37
|
-
const importTexts: string[] = [];
|
|
38
|
-
|
|
39
|
-
if (useExt) {
|
|
40
|
-
importTexts.push('import { DbContextExt } from "@simplysm/sd-orm-common-ext";');
|
|
41
|
-
} else {
|
|
42
|
-
importTexts.push('import { DbContext } from "@simplysm/sd-orm-common";');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Migrations
|
|
46
|
-
const migTexts: string[] = [];
|
|
47
|
-
{
|
|
48
|
-
const filePaths = await FsUtils.globAsync(path.resolve(pkgPath, "src/migrations/**/*.ts"), {
|
|
49
|
-
nodir: true,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
for (const filePath of filePaths.orderBy()) {
|
|
53
|
-
const requirePath = PathUtils.posix(path.relative(path.dirname(targetFilePath), filePath))
|
|
54
|
-
.replace(/\.tsx?$/, "")
|
|
55
|
-
.replace(/\/index$/, "");
|
|
56
|
-
const fileName = path.basename(filePath, path.extname(filePath));
|
|
57
|
-
|
|
58
|
-
const className = fileName.includes("_") ? fileName : StringUtils.toPascalCase(fileName);
|
|
59
|
-
|
|
60
|
-
importTexts.push(`import { ${className} } from "./${requirePath}";`);
|
|
61
|
-
migTexts.push(className + ",");
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Models
|
|
66
|
-
const modelTexts: string[] = [];
|
|
67
|
-
{
|
|
68
|
-
const filePaths = await FsUtils.globAsync(path.resolve(pkgPath, "src/models/**/*.ts"), {
|
|
69
|
-
nodir: true,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
for (const filePath of filePaths.orderBy()) {
|
|
73
|
-
const requirePath = PathUtils.posix(path.relative(path.dirname(targetFilePath), filePath))
|
|
74
|
-
.replace(/\.tsx?$/, "")
|
|
75
|
-
.replace(/\/index$/, "");
|
|
76
|
-
const fileName = path.basename(filePath, path.extname(filePath));
|
|
77
|
-
|
|
78
|
-
const varName = fileName.includes("_") ? fileName : StringUtils.toCamelCase(fileName);
|
|
79
|
-
const className = fileName.includes("_") ? fileName : StringUtils.toPascalCase(fileName);
|
|
80
|
-
|
|
81
|
-
importTexts.push(`import { ${className} } from "./${requirePath}";`);
|
|
82
|
-
if (
|
|
83
|
-
useExt &&
|
|
84
|
-
[
|
|
85
|
-
"systemDataLog",
|
|
86
|
-
"systemLog",
|
|
87
|
-
"authentication",
|
|
88
|
-
"user",
|
|
89
|
-
"userConfig",
|
|
90
|
-
"userPermission",
|
|
91
|
-
].includes(varName)
|
|
92
|
-
) {
|
|
93
|
-
modelTexts.push(`override ${varName} = new Queryable(this, ${className})`);
|
|
94
|
-
} else {
|
|
95
|
-
modelTexts.push(`${varName} = new Queryable(this, ${className})`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Views
|
|
101
|
-
const viewTexts: string[] = [];
|
|
102
|
-
{
|
|
103
|
-
const filePaths = await FsUtils.globAsync(path.resolve(pkgPath, "src/views/**/*.ts"), {
|
|
104
|
-
nodir: true,
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
for (const filePath of filePaths.orderBy()) {
|
|
108
|
-
const requirePath = PathUtils.posix(path.relative(path.dirname(targetFilePath), filePath))
|
|
109
|
-
.replace(/\.tsx?$/, "")
|
|
110
|
-
.replace(/\/index$/, "");
|
|
111
|
-
const fileName = path.basename(filePath, path.extname(filePath));
|
|
112
|
-
|
|
113
|
-
const varName = fileName.includes("_") ? fileName : StringUtils.toCamelCase(fileName);
|
|
114
|
-
const className = fileName.includes("_") ? fileName : StringUtils.toPascalCase(fileName);
|
|
115
|
-
|
|
116
|
-
importTexts.push(`import { ${className} } from "./${requirePath}";`);
|
|
117
|
-
viewTexts.push(`${varName} = new Queryable(this, ${className})`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Stored Procedures
|
|
122
|
-
const spTexts: string[] = [];
|
|
123
|
-
{
|
|
124
|
-
const filePaths = await FsUtils.globAsync(
|
|
125
|
-
path.resolve(pkgPath, "src/stored-procedures/**/*.ts"),
|
|
126
|
-
{
|
|
127
|
-
nodir: true,
|
|
128
|
-
},
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
for (const filePath of filePaths.orderBy()) {
|
|
132
|
-
const requirePath = PathUtils.posix(path.relative(path.dirname(targetFilePath), filePath))
|
|
133
|
-
.replace(/\.tsx?$/, "")
|
|
134
|
-
.replace(/\/index$/, "");
|
|
135
|
-
const fileName = path.basename(filePath, path.extname(filePath));
|
|
136
|
-
|
|
137
|
-
const varName = fileName.includes("_") ? fileName : StringUtils.toCamelCase(fileName);
|
|
138
|
-
const className = fileName.includes("_") ? fileName : StringUtils.toPascalCase(fileName);
|
|
139
|
-
|
|
140
|
-
importTexts.push(`import { ${className} } from "./${requirePath}";`);
|
|
141
|
-
spTexts.push(`${varName} = new StoredProcedure(this, ${className})`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
importTexts.push(
|
|
146
|
-
...[
|
|
147
|
-
`import { IDbMigration${
|
|
148
|
-
modelTexts.length > 0 || viewTexts.length > 0 ? ", Queryable" : ""
|
|
149
|
-
}${spTexts.length > 0 ? ", StoredProcedure" : ""} } from "@simplysm/sd-orm-common";`,
|
|
150
|
-
'import { Type } from "@simplysm/sd-core-common";',
|
|
151
|
-
],
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
const content = `
|
|
155
|
-
${importTexts.join("\n")}
|
|
156
|
-
|
|
157
|
-
export class ${StringUtils.toPascalCase(kebabName)} extends DbContext${useExt ? "Ext" : ""} {
|
|
158
|
-
get migrations(): Type<IDbMigration>[] {
|
|
159
|
-
return [
|
|
160
|
-
${migTexts.map((item) => " " + item).join("\n")}
|
|
161
|
-
];
|
|
162
|
-
}
|
|
163
|
-
${modelTexts.length > 0 ? "\n // Models\n" + modelTexts.map((item) => " " + item).join("\n") : ""}
|
|
164
|
-
${viewTexts.length > 0 ? "\n // Views\n" + viewTexts.map((item) => " " + item).join("\n") : ""}
|
|
165
|
-
${spTexts.length > 0 ? "\n // StoredProcedures\n" + spTexts.map((item) => " " + item).join("\n") : ""}
|
|
166
|
-
}
|
|
167
|
-
`.trim();
|
|
168
|
-
const currHash = HashUtils.get(content);
|
|
169
|
-
if (currHash !== this.cachedHash) {
|
|
170
|
-
await FsUtils.writeFileAsync(targetFilePath, content);
|
|
171
|
-
this.cachedHash = currHash;
|
|
172
|
-
return { changed: true, filePath: targetFilePath, content };
|
|
173
|
-
} else {
|
|
174
|
-
return { changed: false, filePath: targetFilePath, content };
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|