@simplysm/sd-cli 12.16.27 → 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,228 +0,0 @@
|
|
|
1
|
-
import { FsUtils, SdLogger } from "@simplysm/sd-core-node";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { javascript, StringUtils } from "@simplysm/sd-core-common";
|
|
4
|
-
import { SdBuildRunnerBase } from "../SdBuildRunnerBase";
|
|
5
|
-
import { SdServerBundler } from "./SdServerBundler";
|
|
6
|
-
export class SdServerBuildRunner extends SdBuildRunnerBase {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this._logger = SdLogger.get(["simplysm", "sd-cli", "SdServerBuildRunner"]);
|
|
10
|
-
}
|
|
11
|
-
async _runAsync(modifiedFileSet) {
|
|
12
|
-
// 최초
|
|
13
|
-
if (!modifiedFileSet) {
|
|
14
|
-
const externalModules = this._getExternalModules();
|
|
15
|
-
if (!this._opt.watch?.dev) {
|
|
16
|
-
this._generateProductionFiles(externalModules.filter((item) => item.exists).map((item) => item.name));
|
|
17
|
-
}
|
|
18
|
-
if (!this._opt.watch?.noEmit) {
|
|
19
|
-
this._debug("GEN .config...");
|
|
20
|
-
const confDistPath = path.resolve(this._opt.pkgPath, "dist/.config.json");
|
|
21
|
-
FsUtils.writeFile(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
22
|
-
}
|
|
23
|
-
this._debug(`BUILD 준비...`);
|
|
24
|
-
this._serverBundler = new SdServerBundler(this._opt, {
|
|
25
|
-
external: externalModules.map((item) => item.name),
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
this._debug(`BUILD...`);
|
|
29
|
-
const bundleResult = await this._serverBundler.bundleAsync(modifiedFileSet);
|
|
30
|
-
this._debug(`빌드 완료`);
|
|
31
|
-
return bundleResult;
|
|
32
|
-
}
|
|
33
|
-
_generateProductionFiles(externals) {
|
|
34
|
-
const npmConf = FsUtils.readJson(path.resolve(this._opt.pkgPath, "package.json"));
|
|
35
|
-
this._debug("GEN package.json...");
|
|
36
|
-
{
|
|
37
|
-
const projNpmConf = FsUtils.readJson(path.resolve(process.cwd(), "package.json"));
|
|
38
|
-
const distNpmConfig = {
|
|
39
|
-
name: npmConf.name,
|
|
40
|
-
version: npmConf.version,
|
|
41
|
-
type: npmConf.type,
|
|
42
|
-
};
|
|
43
|
-
distNpmConfig.dependencies = {};
|
|
44
|
-
for (const external of externals) {
|
|
45
|
-
distNpmConfig.dependencies[external] = "*";
|
|
46
|
-
}
|
|
47
|
-
distNpmConfig.volta = projNpmConf.volta;
|
|
48
|
-
FsUtils.writeJson(path.resolve(this._opt.pkgPath, "dist/package.json"), distNpmConfig, {
|
|
49
|
-
space: 2,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
this._debug("GEN .yarnrc.yml...");
|
|
53
|
-
{
|
|
54
|
-
FsUtils.writeFile(path.resolve(this._opt.pkgPath, "dist/.yarnrc.yml"), "nodeLinker: node-modules");
|
|
55
|
-
}
|
|
56
|
-
this._debug("GEN openssl.cnf...");
|
|
57
|
-
{
|
|
58
|
-
FsUtils.writeFile(path.resolve(this._opt.pkgPath, "dist/openssl.cnf"), `
|
|
59
|
-
nodejs_conf = openssl_init
|
|
60
|
-
|
|
61
|
-
[openssl_init]
|
|
62
|
-
providers = provider_sect
|
|
63
|
-
ssl_conf = ssl_sect
|
|
64
|
-
|
|
65
|
-
[provider_sect]
|
|
66
|
-
default = default_sect
|
|
67
|
-
legacy = legacy_sect
|
|
68
|
-
|
|
69
|
-
[default_sect]
|
|
70
|
-
activate = 1
|
|
71
|
-
|
|
72
|
-
[legacy_sect]
|
|
73
|
-
activate = 1
|
|
74
|
-
|
|
75
|
-
[ssl_sect]
|
|
76
|
-
system_default = system_default_sect
|
|
77
|
-
|
|
78
|
-
[system_default_sect]
|
|
79
|
-
Options = UnsafeLegacyRenegotiation`.trim());
|
|
80
|
-
}
|
|
81
|
-
if (this._pkgConf.pm2) {
|
|
82
|
-
this._debug("GEN pm2.config.cjs...");
|
|
83
|
-
const str = javascript `
|
|
84
|
-
const cp = require("child_process");
|
|
85
|
-
|
|
86
|
-
const npmConf = require("./package.json");
|
|
87
|
-
|
|
88
|
-
const pm2Conf = ${JSON.stringify(this._pkgConf.pm2)};
|
|
89
|
-
const env = ${JSON.stringify(this._pkgConf.env)};
|
|
90
|
-
|
|
91
|
-
module.exports = {
|
|
92
|
-
name: pm2Conf.name ?? npmConf.name.replace(/@/g, "").replace(/[\\\/]/g, "-"),
|
|
93
|
-
script: "main.js",
|
|
94
|
-
watch: true,
|
|
95
|
-
watch_delay: 2000,
|
|
96
|
-
ignore_watch: [
|
|
97
|
-
"node_modules",
|
|
98
|
-
"www",
|
|
99
|
-
...pm2Conf.ignoreWatchPaths ?? [],
|
|
100
|
-
],
|
|
101
|
-
...pm2Conf.noInterpreter ? {} : { interpreter: cp.execSync("volta which node").toString().trim() },
|
|
102
|
-
interpreter_args: "--openssl-config=openssl.cnf",
|
|
103
|
-
env: {
|
|
104
|
-
NODE_ENV: "production",
|
|
105
|
-
TZ: "Asia/Seoul",
|
|
106
|
-
SD_VERSION: npmConf.version,
|
|
107
|
-
...env ?? {},
|
|
108
|
-
},
|
|
109
|
-
arrayProcess: "concat",
|
|
110
|
-
useDelTargetNull: true
|
|
111
|
-
};`
|
|
112
|
-
.replace(/\n {8}/g, "\n")
|
|
113
|
-
.trim();
|
|
114
|
-
FsUtils.writeFile(path.resolve(this._opt.pkgPath, "dist/pm2.config.cjs"), str);
|
|
115
|
-
}
|
|
116
|
-
if (this._pkgConf.iis) {
|
|
117
|
-
this._debug("GEN web.config...");
|
|
118
|
-
const iisDistPath = path.resolve(this._opt.pkgPath, "dist/web.config");
|
|
119
|
-
const nodeVersion = process.versions.node.substring(1);
|
|
120
|
-
const serverExeFilePath = this._pkgConf.iis.nodeExeFilePath ??
|
|
121
|
-
`%HOMEDRIVE%%HOMEPATH%\\AppData\\Local\\Volta\\tools\\image\\node\\${nodeVersion}\\node.exe`;
|
|
122
|
-
FsUtils.writeFile(iisDistPath, `
|
|
123
|
-
<configuration>
|
|
124
|
-
<appSettings>
|
|
125
|
-
<add key="NODE_ENV" value="production" />
|
|
126
|
-
<add key="TZ" value="Asia/Seoul" />
|
|
127
|
-
<add key="SD_VERSION" value="${npmConf.version}" />
|
|
128
|
-
${Object.keys(this._pkgConf.env ?? {})
|
|
129
|
-
.map((key) => `<add key="${key}" value="${this._pkgConf.env[key]}"/>`)
|
|
130
|
-
.join("\n ")}
|
|
131
|
-
</appSettings>
|
|
132
|
-
<system.webServer>
|
|
133
|
-
<handlers>
|
|
134
|
-
<add name="iisnode" path="main.js" verb="*" modules="iisnode" />
|
|
135
|
-
</handlers>
|
|
136
|
-
<iisnode nodeProcessCommandLine="${serverExeFilePath} --openssl-config=openssl.cnf"
|
|
137
|
-
watchedFiles="web.config;*.js"
|
|
138
|
-
loggingEnabled="true"
|
|
139
|
-
devErrorsEnabled="true" />
|
|
140
|
-
<rewrite>
|
|
141
|
-
<rules>
|
|
142
|
-
<rule name="main">
|
|
143
|
-
<action type="Rewrite" url="main.js" />
|
|
144
|
-
</rule>
|
|
145
|
-
</rules>
|
|
146
|
-
</rewrite>
|
|
147
|
-
<httpErrors errorMode="Detailed" />
|
|
148
|
-
</system.webServer>
|
|
149
|
-
</configuration>`.trim());
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
_getExternalModules() {
|
|
153
|
-
const loadedModuleNames = [];
|
|
154
|
-
const results = [];
|
|
155
|
-
const npmConfigMap = new Map();
|
|
156
|
-
const fn = (currPath) => {
|
|
157
|
-
const npmConfig = npmConfigMap.getOrCreate(currPath, FsUtils.readJson(path.resolve(currPath, "package.json")));
|
|
158
|
-
const deps = {
|
|
159
|
-
defaults: [
|
|
160
|
-
...Object.keys(npmConfig.dependencies ?? {}),
|
|
161
|
-
...Object.keys(npmConfig.peerDependencies ?? {}).filter((item) => !npmConfig.peerDependenciesMeta?.[item]?.optional),
|
|
162
|
-
].distinct(),
|
|
163
|
-
optionals: [
|
|
164
|
-
...Object.keys(npmConfig.optionalDependencies ?? {}),
|
|
165
|
-
...Object.keys(npmConfig.peerDependencies ?? {}).filter((item) => npmConfig.peerDependenciesMeta?.[item]?.optional ?? false),
|
|
166
|
-
].distinct(),
|
|
167
|
-
};
|
|
168
|
-
for (const moduleName of deps.defaults) {
|
|
169
|
-
if (loadedModuleNames.includes(moduleName))
|
|
170
|
-
continue;
|
|
171
|
-
loadedModuleNames.push(moduleName);
|
|
172
|
-
const modulePath = FsUtils.findAllParentChildPaths("node_modules/" + moduleName, currPath, path.resolve(this._opt.pkgPath, "../../")).first();
|
|
173
|
-
if (StringUtils.isNullOrEmpty(modulePath)) {
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
if (FsUtils.glob(path.resolve(modulePath, "binding.gyp")).length > 0) {
|
|
177
|
-
results.push({
|
|
178
|
-
name: moduleName,
|
|
179
|
-
exists: true,
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
if (this._pkgConf.externals?.includes(moduleName)) {
|
|
183
|
-
results.push({
|
|
184
|
-
name: moduleName,
|
|
185
|
-
exists: true,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
fn(modulePath);
|
|
189
|
-
}
|
|
190
|
-
for (const optModuleName of deps.optionals) {
|
|
191
|
-
if (loadedModuleNames.includes(optModuleName))
|
|
192
|
-
continue;
|
|
193
|
-
loadedModuleNames.push(optModuleName);
|
|
194
|
-
const optModulePath = FsUtils.findAllParentChildPaths("node_modules/" + optModuleName, currPath, path.resolve(this._opt.pkgPath, "../../")).first();
|
|
195
|
-
if (StringUtils.isNullOrEmpty(optModulePath)) {
|
|
196
|
-
results.push({
|
|
197
|
-
name: optModuleName,
|
|
198
|
-
exists: false,
|
|
199
|
-
});
|
|
200
|
-
continue;
|
|
201
|
-
}
|
|
202
|
-
if (FsUtils.glob(path.resolve(optModulePath, "binding.gyp")).length > 0) {
|
|
203
|
-
results.push({
|
|
204
|
-
name: optModuleName,
|
|
205
|
-
exists: true,
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
if (this._pkgConf.externals?.includes(optModuleName)) {
|
|
209
|
-
results.push({
|
|
210
|
-
name: optModuleName,
|
|
211
|
-
exists: true,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
fn(optModulePath);
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
fn(this._opt.pkgPath);
|
|
218
|
-
for (const external of this._pkgConf.externals ?? []) {
|
|
219
|
-
if (!results.some((item) => item.name === external)) {
|
|
220
|
-
results.push({
|
|
221
|
-
name: external,
|
|
222
|
-
exists: false,
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return results;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
-
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
3
|
-
import { ISdTsCompilerOptions } from "../../types/build/ISdTsCompilerOptions";
|
|
4
|
-
export declare class SdServerBundler {
|
|
5
|
-
private readonly _opt;
|
|
6
|
-
private readonly _conf;
|
|
7
|
-
private readonly _logger;
|
|
8
|
-
private _context?;
|
|
9
|
-
private readonly _modifiedFileSet;
|
|
10
|
-
private readonly _resultCache;
|
|
11
|
-
private readonly _outputHashCache;
|
|
12
|
-
private readonly _esbuildOptions;
|
|
13
|
-
constructor(_opt: ISdTsCompilerOptions, _conf: {
|
|
14
|
-
external: string[];
|
|
15
|
-
});
|
|
16
|
-
bundleAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult>;
|
|
17
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { FsUtils, HashUtils, PathUtils, SdLogger } from "@simplysm/sd-core-node";
|
|
4
|
-
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
5
|
-
import { createSdServerPlugin } from "./createSdServerPlugin";
|
|
6
|
-
import { BuildOutputFileType, } from "@angular/build/src/tools/esbuild/bundler-context";
|
|
7
|
-
import { convertOutputFile } from "@angular/build/src/tools/esbuild/utils";
|
|
8
|
-
import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
|
|
9
|
-
import { SdWorkerPathPlugin } from "../commons/SdWorkerPathPlugin";
|
|
10
|
-
export class SdServerBundler {
|
|
11
|
-
constructor(_opt, _conf) {
|
|
12
|
-
this._opt = _opt;
|
|
13
|
-
this._conf = _conf;
|
|
14
|
-
this._logger = SdLogger.get(["simplysm", "sd-cli", "SdServerBundler"]);
|
|
15
|
-
this._modifiedFileSet = new Set();
|
|
16
|
-
this._resultCache = {};
|
|
17
|
-
this._outputHashCache = new Map();
|
|
18
|
-
this._esbuildOptions = {
|
|
19
|
-
entryPoints: [
|
|
20
|
-
path.resolve(this._opt.pkgPath, "src/main.ts"),
|
|
21
|
-
// ...FsUtils.glob(path.resolve(this._opt.pkgPath, "src/workers/*.ts")),
|
|
22
|
-
],
|
|
23
|
-
keepNames: true,
|
|
24
|
-
bundle: true,
|
|
25
|
-
sourcemap: !!this._opt.watch?.dev,
|
|
26
|
-
target: "node18",
|
|
27
|
-
mainFields: ["es2020", "es2015", "module", "main"],
|
|
28
|
-
conditions: ["es2020", "es2015", "module"],
|
|
29
|
-
tsconfig: path.resolve(this._opt.pkgPath, "tsconfig.json"),
|
|
30
|
-
write: false,
|
|
31
|
-
metafile: true,
|
|
32
|
-
legalComments: this._opt.watch?.dev ? "eof" : "none",
|
|
33
|
-
minifyIdentifiers: !this._opt.watch?.dev,
|
|
34
|
-
minifySyntax: !this._opt.watch?.dev,
|
|
35
|
-
minifyWhitespace: !this._opt.watch?.dev,
|
|
36
|
-
outdir: path.resolve(this._opt.pkgPath, "dist"),
|
|
37
|
-
format: "esm",
|
|
38
|
-
resolveExtensions: [".js", ".mjs", ".cjs", ".ts"],
|
|
39
|
-
preserveSymlinks: false,
|
|
40
|
-
loader: {
|
|
41
|
-
".png": "file",
|
|
42
|
-
".jpeg": "file",
|
|
43
|
-
".jpg": "file",
|
|
44
|
-
".jfif": "file",
|
|
45
|
-
".gif": "file",
|
|
46
|
-
".svg": "file",
|
|
47
|
-
".woff": "file",
|
|
48
|
-
".woff2": "file",
|
|
49
|
-
".ttf": "file",
|
|
50
|
-
".ttc": "file",
|
|
51
|
-
".eot": "file",
|
|
52
|
-
".ico": "file",
|
|
53
|
-
".otf": "file",
|
|
54
|
-
".csv": "file",
|
|
55
|
-
".xlsx": "file",
|
|
56
|
-
".xls": "file",
|
|
57
|
-
".pptx": "file",
|
|
58
|
-
".ppt": "file",
|
|
59
|
-
".docx": "file",
|
|
60
|
-
".doc": "file",
|
|
61
|
-
".zip": "file",
|
|
62
|
-
".pfx": "file",
|
|
63
|
-
".pkl": "file",
|
|
64
|
-
".mp3": "file",
|
|
65
|
-
".ogg": "file",
|
|
66
|
-
},
|
|
67
|
-
platform: "node",
|
|
68
|
-
logLevel: "silent",
|
|
69
|
-
external: this._conf.external,
|
|
70
|
-
banner: {
|
|
71
|
-
js: `
|
|
72
|
-
import __path__ from 'path';
|
|
73
|
-
import { fileURLToPath as __fileURLToPath__ } from 'url';
|
|
74
|
-
import { createRequire as __createRequire__ } from 'module';
|
|
75
|
-
|
|
76
|
-
const require = __createRequire__(import.meta.url);
|
|
77
|
-
const __filename = __fileURLToPath__(import.meta.url);
|
|
78
|
-
const __dirname = __path__.dirname(__filename);`.trim(),
|
|
79
|
-
},
|
|
80
|
-
plugins: [
|
|
81
|
-
createSdServerPlugin(this._opt, this._modifiedFileSet, this._resultCache),
|
|
82
|
-
SdWorkerPathPlugin(path.resolve(this._opt.pkgPath, "dist")),
|
|
83
|
-
],
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
async bundleAsync(modifiedFileSet) {
|
|
87
|
-
this._modifiedFileSet.clear();
|
|
88
|
-
if (modifiedFileSet) {
|
|
89
|
-
this._modifiedFileSet.adds(...modifiedFileSet);
|
|
90
|
-
}
|
|
91
|
-
let esbuildResult;
|
|
92
|
-
if (this._opt.watch) {
|
|
93
|
-
if (this._context == null) {
|
|
94
|
-
this._context = await esbuild.context(this._esbuildOptions);
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
esbuildResult = await this._context.rebuild();
|
|
98
|
-
}
|
|
99
|
-
catch (err) {
|
|
100
|
-
if ("warnings" in err || "errors" in err) {
|
|
101
|
-
esbuildResult = err;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
throw err;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
try {
|
|
110
|
-
esbuildResult = await esbuild.build(this._esbuildOptions);
|
|
111
|
-
}
|
|
112
|
-
catch (err) {
|
|
113
|
-
if ("warnings" in err || "errors" in err) {
|
|
114
|
-
esbuildResult = err;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
throw err;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
if (this._opt.watch?.noEmit) {
|
|
122
|
-
return {
|
|
123
|
-
buildMessages: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(esbuildResult, this._opt.pkgPath),
|
|
124
|
-
watchFileSet: this._resultCache.watchFileSet,
|
|
125
|
-
affectedFileSet: this._resultCache.affectedFileSet,
|
|
126
|
-
emitFileSet: new Set(),
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
const emitFileSet = new Set();
|
|
131
|
-
try {
|
|
132
|
-
const outputFiles = esbuildResult.outputFiles?.map((file) => convertOutputFile(file, BuildOutputFileType.Root)) ?? [];
|
|
133
|
-
for (const outputFile of outputFiles) {
|
|
134
|
-
const distFilePath = PathUtils.norm(this._opt.pkgPath, outputFile.path);
|
|
135
|
-
const prevHash = this._outputHashCache.get(distFilePath);
|
|
136
|
-
const currHash = HashUtils.get(Buffer.from(outputFile.contents));
|
|
137
|
-
if (prevHash !== currHash) {
|
|
138
|
-
FsUtils.writeFile(distFilePath, outputFile.contents);
|
|
139
|
-
this._outputHashCache.set(distFilePath, currHash);
|
|
140
|
-
emitFileSet.add(distFilePath);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
//-- copy assets
|
|
144
|
-
const assetFiles = await resolveAssets([
|
|
145
|
-
{ input: "public", glob: "**/*", output: "." },
|
|
146
|
-
...(this._opt.watch?.dev ? [{ input: "public-dev", glob: "**/*", output: "." }] : []),
|
|
147
|
-
], this._opt.pkgPath);
|
|
148
|
-
for (const assetFile of assetFiles) {
|
|
149
|
-
const prevHash = this._outputHashCache.get(PathUtils.norm(assetFile.source));
|
|
150
|
-
const currHash = HashUtils.get(FsUtils.readFileBuffer(assetFile.source));
|
|
151
|
-
if (prevHash !== currHash) {
|
|
152
|
-
FsUtils.copy(assetFile.source, path.resolve(this._opt.pkgPath, "dist", assetFile.destination));
|
|
153
|
-
this._outputHashCache.set(PathUtils.norm(assetFile.source), currHash);
|
|
154
|
-
emitFileSet.add(PathUtils.norm(this._opt.pkgPath, "dist", assetFile.destination));
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
catch (err) {
|
|
159
|
-
esbuildResult = err;
|
|
160
|
-
for (const e of err.errors) {
|
|
161
|
-
if (e.detail != null) {
|
|
162
|
-
this._logger.error(e.detail);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
buildMessages: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(esbuildResult, this._opt.pkgPath),
|
|
168
|
-
watchFileSet: this._resultCache.watchFileSet,
|
|
169
|
-
affectedFileSet: this._resultCache.affectedFileSet,
|
|
170
|
-
emitFileSet: emitFileSet,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import { TNormPath } from "@simplysm/sd-core-node";
|
|
3
|
-
import { ISdCliServerPluginResultCache } from "../../types/plugin/ISdCliServerPluginResultCache";
|
|
4
|
-
import { ISdTsCompilerOptions } from "../../types/build/ISdTsCompilerOptions";
|
|
5
|
-
export declare function createSdServerPlugin(conf: ISdTsCompilerOptions, modifiedFileSet: Set<TNormPath>, resultCache: ISdCliServerPluginResultCache): esbuild.Plugin;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
2
|
-
import { PathUtils } from "@simplysm/sd-core-node";
|
|
3
|
-
import { SdTsCompiler } from "../../ts-compiler/SdTsCompiler";
|
|
4
|
-
export function createSdServerPlugin(conf, modifiedFileSet, resultCache) {
|
|
5
|
-
return {
|
|
6
|
-
name: "sd-server-plugin",
|
|
7
|
-
setup: (build) => {
|
|
8
|
-
const tsCompiler = new SdTsCompiler(conf, true);
|
|
9
|
-
let tsCompileResult;
|
|
10
|
-
build.onStart(async () => {
|
|
11
|
-
tsCompileResult = await tsCompiler.compileAsync(modifiedFileSet);
|
|
12
|
-
resultCache.watchFileSet = tsCompileResult.watchFileSet;
|
|
13
|
-
resultCache.affectedFileSet = tsCompileResult.affectedFileSet;
|
|
14
|
-
//-- return err/warn
|
|
15
|
-
return SdCliConvertMessageUtils.convertToEsbuildFromBuildMessages(tsCompileResult.messages, conf.pkgPath);
|
|
16
|
-
});
|
|
17
|
-
build.onLoad({ filter: /\.ts$/ }, (args) => {
|
|
18
|
-
const emittedJsFile = tsCompileResult.emittedFilesCacheMap
|
|
19
|
-
.get(PathUtils.norm(args.path))
|
|
20
|
-
?.last();
|
|
21
|
-
/*if (!emittedJsFile) {
|
|
22
|
-
return {
|
|
23
|
-
errors: [
|
|
24
|
-
{
|
|
25
|
-
text: `ts 빌더 결과 emit 파일이 존재하지 않습니다. ${args.path}`,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
};
|
|
29
|
-
}*/
|
|
30
|
-
return { contents: emittedJsFile?.text, loader: "js" };
|
|
31
|
-
});
|
|
32
|
-
build.onLoad({ filter: /\.[cm]?js$/ }, (args) => {
|
|
33
|
-
resultCache.watchFileSet.add(PathUtils.norm(args.path));
|
|
34
|
-
return null;
|
|
35
|
-
});
|
|
36
|
-
build.onLoad({
|
|
37
|
-
filter: new RegExp("(" +
|
|
38
|
-
Object.keys(build.initialOptions.loader)
|
|
39
|
-
.map((item) => "\\" + item)
|
|
40
|
-
.join("|") +
|
|
41
|
-
")$"),
|
|
42
|
-
}, (args) => {
|
|
43
|
-
resultCache.watchFileSet.add(PathUtils.norm(args.path));
|
|
44
|
-
return null;
|
|
45
|
-
});
|
|
46
|
-
build.onEnd((result) => {
|
|
47
|
-
resultCache.outputFiles = result.outputFiles;
|
|
48
|
-
resultCache.metafile = result.metafile;
|
|
49
|
-
modifiedFileSet.clear();
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
}
|
package/dist/sd-cli-entry.d.ts
DELETED