@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,420 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { FsUtils, PathUtils, SdLogger } from "@simplysm/sd-core-node";
|
|
4
|
-
import { StringUtils } from "@simplysm/sd-core-common";
|
|
5
|
-
import { NgtscProgram, OptimizeFor } from "@angular/compiler-cli";
|
|
6
|
-
import { SdCliPerformanceTimer } from "../utils/SdCliPerformanceTimer";
|
|
7
|
-
import { SdCliConvertMessageUtils } from "../utils/SdCliConvertMessageUtils";
|
|
8
|
-
import { createWorkerTransformer } from "@angular/build/src/tools/angular/transformers/web-worker-transformer";
|
|
9
|
-
import { replaceBootstrap } from "@angular/build/src/tools/angular/transformers/jit-bootstrap-transformer";
|
|
10
|
-
import { SdDepCache } from "./SdDepCache";
|
|
11
|
-
import { SdDepAnalyzer } from "./SdDepAnalyzer";
|
|
12
|
-
import { FlatESLint } from "eslint/use-at-your-own-risk";
|
|
13
|
-
import { SdStyleBundler } from "./SdStyleBundler";
|
|
14
|
-
import { ScopePathSet } from "./ScopePathSet";
|
|
15
|
-
export class SdTsCompiler {
|
|
16
|
-
constructor(_opt, _forBundle) {
|
|
17
|
-
this._opt = _opt;
|
|
18
|
-
this._forBundle = _forBundle;
|
|
19
|
-
this._logger = SdLogger.get(["simplysm", "sd-cli", "SdTsCompiler"]);
|
|
20
|
-
// 빌드정보 캐싱
|
|
21
|
-
this._cache = {
|
|
22
|
-
dep: new SdDepCache(),
|
|
23
|
-
type: new WeakMap(),
|
|
24
|
-
prop: new WeakMap(),
|
|
25
|
-
declFiles: new WeakMap(),
|
|
26
|
-
ngOrg: new Map(),
|
|
27
|
-
};
|
|
28
|
-
this._sourceFileCacheMap = new Map();
|
|
29
|
-
this._emittedFilesCacheMap = new Map();
|
|
30
|
-
this._debug("초기화 중...");
|
|
31
|
-
const tsconfigPath = path.resolve(this._opt.pkgPath, "tsconfig.json");
|
|
32
|
-
const tsconfig = FsUtils.readJson(tsconfigPath);
|
|
33
|
-
this._isForAngular = Boolean(tsconfig.angularCompilerOptions);
|
|
34
|
-
this._scopePathSet = new ScopePathSet(this._opt.scopePathSet);
|
|
35
|
-
if (!this._opt.watch?.noEmit) {
|
|
36
|
-
this._styleBundler = new SdStyleBundler({
|
|
37
|
-
pkgPath: this._opt.pkgPath,
|
|
38
|
-
scopePathSet: this._scopePathSet,
|
|
39
|
-
dev: !!this._opt.watch?.dev,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
_parseTsConfig() {
|
|
44
|
-
const tsconfigPath = path.resolve(this._opt.pkgPath, "tsconfig.json");
|
|
45
|
-
const tsconfig = FsUtils.readJson(tsconfigPath);
|
|
46
|
-
const parsedTsconfig = ts.parseJsonConfigFileContent(tsconfig, ts.sys, this._opt.pkgPath, {
|
|
47
|
-
...tsconfig.angularCompilerOptions,
|
|
48
|
-
...(this._forBundle ? { declaration: false } : {}),
|
|
49
|
-
...(this._opt.watch?.emitOnly
|
|
50
|
-
? {
|
|
51
|
-
// typescript
|
|
52
|
-
noEmitOnError: false,
|
|
53
|
-
skipLibCheck: true,
|
|
54
|
-
skipDefaultLibCheck: true,
|
|
55
|
-
// angular
|
|
56
|
-
strictTemplates: false,
|
|
57
|
-
strictInjectionParameters: false,
|
|
58
|
-
strictInputAccessModifiers: false,
|
|
59
|
-
strictStandalone: false,
|
|
60
|
-
extendedDiagnostics: false,
|
|
61
|
-
}
|
|
62
|
-
: {}),
|
|
63
|
-
sourceMap: !!this._opt.watch?.dev,
|
|
64
|
-
});
|
|
65
|
-
const distPath = PathUtils.norm(parsedTsconfig.options.outDir ?? path.resolve(this._opt.pkgPath, "dist"));
|
|
66
|
-
return {
|
|
67
|
-
fileNames: parsedTsconfig.fileNames,
|
|
68
|
-
options: parsedTsconfig.options,
|
|
69
|
-
distPath: distPath,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
_createCompilerHost(compilerOptions, modifiedFileSet) {
|
|
73
|
-
// 지식: SourceFile은 하나의 파일에만 국한된 정적 정보객체임, 변경된 파일의 SourceFile만 다시 생성하면됨
|
|
74
|
-
const compilerHost = ts.createCompilerHost(compilerOptions);
|
|
75
|
-
const baseGetSourceFile = compilerHost.getSourceFile;
|
|
76
|
-
compilerHost.getSourceFile = (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile, ...args) => {
|
|
77
|
-
const fileNPath = PathUtils.norm(fileName);
|
|
78
|
-
/*if (!shouldCreateNewSourceFile && this.#sourceFileCacheMap.has(fileNPath)) {
|
|
79
|
-
return this.#sourceFileCacheMap.get(fileNPath);
|
|
80
|
-
}*/
|
|
81
|
-
if (this._sourceFileCacheMap.has(fileNPath)) {
|
|
82
|
-
return this._sourceFileCacheMap.get(fileNPath);
|
|
83
|
-
}
|
|
84
|
-
const sf = baseGetSourceFile.call(compilerHost, fileName, languageVersionOrOptions, onError, false, ...args);
|
|
85
|
-
if (!sf) {
|
|
86
|
-
this._sourceFileCacheMap.delete(fileNPath);
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
this._sourceFileCacheMap.set(fileNPath, sf);
|
|
90
|
-
return sf;
|
|
91
|
-
};
|
|
92
|
-
if (this._isForAngular) {
|
|
93
|
-
compilerHost.readResource = (fileName) => {
|
|
94
|
-
return compilerHost.readFile(fileName) ?? "";
|
|
95
|
-
};
|
|
96
|
-
if (!this._opt.watch?.noEmit) {
|
|
97
|
-
compilerHost.transformResource = async (data, context) => {
|
|
98
|
-
if (context.type !== "style") {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
const styleBundleResult = await this._styleBundler.bundleAsync(data, PathUtils.norm(context.containingFile), context.resourceFile != null ? PathUtils.norm(context.resourceFile) : undefined);
|
|
102
|
-
return StringUtils.isNullOrEmpty(styleBundleResult.contents)
|
|
103
|
-
? null
|
|
104
|
-
: { content: styleBundleResult.contents };
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
compilerHost.getModifiedResourceFiles = () => {
|
|
108
|
-
return new Set(Array.from(modifiedFileSet).map((item) => PathUtils.posix(item)));
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
this._moduleResolutionCache = ts.createModuleResolutionCache(compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName.bind(compilerHost), compilerOptions, this._moduleResolutionCache?.getPackageJsonInfoCache());
|
|
112
|
-
compilerHost.getModuleResolutionCache = () => this._moduleResolutionCache;
|
|
113
|
-
return compilerHost;
|
|
114
|
-
}
|
|
115
|
-
async compileAsync(modifiedFileSet) {
|
|
116
|
-
this._perf = new SdCliPerformanceTimer("esbuild compile");
|
|
117
|
-
const prepareResult = await this._prepareAsync(modifiedFileSet);
|
|
118
|
-
const [globalStyleSheet, lintResults, buildResult] = await Promise.all([
|
|
119
|
-
this._opt.watch?.noEmit ? Promise.resolve(undefined) : this._buildGlobalStyleAsync(),
|
|
120
|
-
this._opt.watch?.emitOnly ? Promise.resolve([]) : this._lintAsync(prepareResult),
|
|
121
|
-
Promise.resolve(this._build(prepareResult)),
|
|
122
|
-
]);
|
|
123
|
-
const messages = [
|
|
124
|
-
...SdCliConvertMessageUtils.convertToBuildMessagesFromTsDiag(buildResult.diagnostics),
|
|
125
|
-
...SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(lintResults),
|
|
126
|
-
];
|
|
127
|
-
const affectedFileSet = new Set([
|
|
128
|
-
...prepareResult.affectedFileSet,
|
|
129
|
-
...(this._styleBundler?.getAffectedFileSet(modifiedFileSet) ?? []),
|
|
130
|
-
]);
|
|
131
|
-
const watchFileSet = new Set([
|
|
132
|
-
...prepareResult.watchFileSet,
|
|
133
|
-
...(this._styleBundler?.getAllStyleFileSet() ?? []),
|
|
134
|
-
]);
|
|
135
|
-
this._debug(`빌드 완료됨`, this._perf.toString());
|
|
136
|
-
this._debug(`영향 받은 파일: ${affectedFileSet.size}개`, ...(modifiedFileSet.size > 0 ? [affectedFileSet] : []));
|
|
137
|
-
this._debug(`감시 중인 파일: ${watchFileSet.size}개`);
|
|
138
|
-
return {
|
|
139
|
-
messages: messages,
|
|
140
|
-
affectedFileSet: affectedFileSet,
|
|
141
|
-
watchFileSet: watchFileSet,
|
|
142
|
-
stylesheetBundlingResultMap: this._styleBundler?.getResultCache() ?? new Map(),
|
|
143
|
-
emittedFilesCacheMap: this._emittedFilesCacheMap,
|
|
144
|
-
emitFileSet: new Set([...buildResult.emitFileSet, globalStyleSheet].filterExists()),
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
async _prepareAsync(modifiedFileSet) {
|
|
148
|
-
const tsconfig = this._parseTsConfig();
|
|
149
|
-
if (modifiedFileSet.size !== 0 && this._opt.watch) {
|
|
150
|
-
this._debug(`캐시 무효화 및 초기화 중...`);
|
|
151
|
-
// this._perf.run("캐시 무효화 및 초기화", () => {
|
|
152
|
-
this._perf.run("캐시 무효화 및 초기화", () => {
|
|
153
|
-
// 소스파일은 변경된 파일들로 무효화
|
|
154
|
-
for (const modifiedFile of modifiedFileSet) {
|
|
155
|
-
this._sourceFileCacheMap.delete(modifiedFile);
|
|
156
|
-
}
|
|
157
|
-
// 스타일 번들러 무효화 (transformResource 재실행 땜에 필요할듯)
|
|
158
|
-
if (this._styleBundler) {
|
|
159
|
-
const styleAffectedFileSet = this._styleBundler.invalidate(modifiedFileSet);
|
|
160
|
-
// 스타일 변경된 파일들로 무효화
|
|
161
|
-
for (const styleAffectedFile of styleAffectedFileSet) {
|
|
162
|
-
this._sourceFileCacheMap.delete(styleAffectedFile);
|
|
163
|
-
this._emittedFilesCacheMap.delete(styleAffectedFile);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
// angular origin 파일 매핑은 변경된 파일들로 무효화
|
|
167
|
-
for (const modifiedFile of modifiedFileSet) {
|
|
168
|
-
this._cache.ngOrg.delete(modifiedFile);
|
|
169
|
-
}
|
|
170
|
-
// 기존 의존성에 의해 영향받는 파일들 계산
|
|
171
|
-
this._cache.dep.invalidates(modifiedFileSet);
|
|
172
|
-
// 결과물이 바뀌어야 하는 캐시 모두 무효화 (modified만 다시쓰면될듯..)
|
|
173
|
-
for (const modifiedFile of modifiedFileSet) {
|
|
174
|
-
this._emittedFilesCacheMap.delete(modifiedFile);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
this._debug(`ts.Program 생성 중...`);
|
|
179
|
-
const compilerHost = this._perf.run("ts.CompilerHost 생성", () => {
|
|
180
|
-
return this._createCompilerHost(tsconfig.options, modifiedFileSet);
|
|
181
|
-
});
|
|
182
|
-
this._perf.run("ts.Program 생성", () => {
|
|
183
|
-
if (this._isForAngular) {
|
|
184
|
-
this._ngProgram = new NgtscProgram(tsconfig.fileNames, tsconfig.options, compilerHost, this._ngProgram);
|
|
185
|
-
this._program = this._ngProgram.getTsProgram();
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
this._program = ts.createProgram(tsconfig.fileNames, tsconfig.options, compilerHost, this._program);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
if (this._ngProgram) {
|
|
192
|
-
this._debug(`Angular 템플릿 분석...`);
|
|
193
|
-
await this._perf.run("Angular 템플릿 분석", async () => {
|
|
194
|
-
await this._ngProgram.compiler.analyzeAsync();
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
if (this._opt.watch && !this._opt.watch.emitOnly) {
|
|
198
|
-
this._debug(`새 의존성 분석 중...`);
|
|
199
|
-
this._perf.run("새 의존성 분석", () => {
|
|
200
|
-
// SdTsDependencyAnalyzer를 통해 의존성 분석 및 SdDepCache 업데이트
|
|
201
|
-
SdDepAnalyzer.analyze(this._program, compilerHost, this._scopePathSet, this._cache);
|
|
202
|
-
});
|
|
203
|
-
// Angular 리소스 의존성 추가
|
|
204
|
-
if (this._ngProgram) {
|
|
205
|
-
this._debug(`새 의존성 분석(Angular) 중...`);
|
|
206
|
-
this._perf.run("새 의존성 분석(Angular)", () => {
|
|
207
|
-
SdDepAnalyzer.analyzeAngularResources(this._ngProgram, this._scopePathSet, this._cache.dep);
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
const allTsFiles = this._program.getSourceFiles().mapMany((item) => [
|
|
212
|
-
PathUtils.norm(item.fileName),
|
|
213
|
-
...(item.fileName.endsWith(".d.ts")
|
|
214
|
-
? [PathUtils.norm(item.fileName.replace(/\.d\.ts$/, "") + ".js")]
|
|
215
|
-
: []),
|
|
216
|
-
]);
|
|
217
|
-
const watchFileSet = new Set(allTsFiles.filter((item) => this._scopePathSet.inScope(item)));
|
|
218
|
-
let affectedFileSet;
|
|
219
|
-
if (modifiedFileSet.size === 0) {
|
|
220
|
-
affectedFileSet = new Set(allTsFiles.filter((item) => this._scopePathSet.inScope(item)));
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
const affectedFileMap = this._cache.dep.getAffectedFileMap(modifiedFileSet);
|
|
224
|
-
affectedFileSet = new Set(Array.from(affectedFileMap.values()).mapMany((item) => Array.from(item)));
|
|
225
|
-
}
|
|
226
|
-
return {
|
|
227
|
-
tsconfig,
|
|
228
|
-
compilerHost,
|
|
229
|
-
watchFileSet,
|
|
230
|
-
affectedFileSet,
|
|
231
|
-
styleAffectedFileSet: this._styleBundler?.getAffectedFileSet(modifiedFileSet) ?? new Set(),
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
async _lintAsync(prepareResult) {
|
|
235
|
-
return await this._perf.run("Linting", async () => {
|
|
236
|
-
this._debug(`Linting...`);
|
|
237
|
-
const lintFilePaths = Array.from(prepareResult.affectedFileSet)
|
|
238
|
-
.filter((item) => PathUtils.isChildPath(item, this._opt.pkgPath))
|
|
239
|
-
.filter((item) => (!item.endsWith(".d.ts") && item.endsWith(".ts")) || item.endsWith(".js"))
|
|
240
|
-
.filter((item) => FsUtils.exists(item));
|
|
241
|
-
if (lintFilePaths.length === 0) {
|
|
242
|
-
return [];
|
|
243
|
-
}
|
|
244
|
-
const linter = new FlatESLint({
|
|
245
|
-
cwd: this._opt.pkgPath,
|
|
246
|
-
cache: false,
|
|
247
|
-
overrideConfig: {
|
|
248
|
-
languageOptions: {
|
|
249
|
-
parserOptions: {
|
|
250
|
-
// project: true,
|
|
251
|
-
// tsconfigRootDir: this._opt.pkgPath,
|
|
252
|
-
project: null,
|
|
253
|
-
programs: [this._program],
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
});
|
|
258
|
-
// const result = await lintFilePaths.parallelAsync(async (lintFilePath) => {
|
|
259
|
-
// const sf = this.#sourceFileCacheMap.get(lintFilePath);
|
|
260
|
-
// if (!sf) return [];
|
|
261
|
-
// return await linter.lintText(sf.text, { filePath: lintFilePath });
|
|
262
|
-
// });
|
|
263
|
-
const result = await linter.lintFiles(lintFilePaths);
|
|
264
|
-
this._debug(`Linting 완료`);
|
|
265
|
-
// return result.mapMany();
|
|
266
|
-
return result;
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
async _buildGlobalStyleAsync() {
|
|
270
|
-
if (!this._isForAngular)
|
|
271
|
-
return;
|
|
272
|
-
//-- global style
|
|
273
|
-
const globalStyleFilePath = PathUtils.norm(this._opt.pkgPath, "scss/styles.scss");
|
|
274
|
-
if (this._emittedFilesCacheMap.has(globalStyleFilePath))
|
|
275
|
-
return;
|
|
276
|
-
if (!FsUtils.exists(globalStyleFilePath))
|
|
277
|
-
return;
|
|
278
|
-
this._debug(`전역 스타일 번들링 중...`);
|
|
279
|
-
await this._perf.run("전역 스타일 번들링", async () => {
|
|
280
|
-
const data = await FsUtils.readFileAsync(globalStyleFilePath);
|
|
281
|
-
const stylesheetBundlingResult = await this._styleBundler.bundleAsync(data, globalStyleFilePath, globalStyleFilePath);
|
|
282
|
-
const emitFileInfos = this._emittedFilesCacheMap.getOrCreate(globalStyleFilePath, []);
|
|
283
|
-
emitFileInfos.push({
|
|
284
|
-
outAbsPath: PathUtils.norm(this._opt.pkgPath, path
|
|
285
|
-
.relative(path.resolve(this._opt.pkgPath, "scss"), globalStyleFilePath)
|
|
286
|
-
.replace(/\.scss$/, ".css")),
|
|
287
|
-
text: stylesheetBundlingResult.contents ?? "",
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
|
-
return globalStyleFilePath;
|
|
291
|
-
}
|
|
292
|
-
_build(prepareResult) {
|
|
293
|
-
const emitFileSet = new Set();
|
|
294
|
-
const diagnostics = [];
|
|
295
|
-
if (!this._opt.watch?.emitOnly) {
|
|
296
|
-
this._debug(`프로그램 진단 수집 중...`);
|
|
297
|
-
this._perf.run("프로그램 진단 수집", () => {
|
|
298
|
-
diagnostics.push(...this._program.getConfigFileParsingDiagnostics(), ...this._program.getOptionsDiagnostics(), ...this._program.getGlobalDiagnostics());
|
|
299
|
-
if (this._ngProgram) {
|
|
300
|
-
diagnostics.push(...this._ngProgram.compiler.getOptionDiagnostics());
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
this._debug(`개별 파일 진단 수집 중...`);
|
|
304
|
-
for (const affectedFile of prepareResult.affectedFileSet) {
|
|
305
|
-
if (!PathUtils.isChildPath(affectedFile, this._opt.pkgPath))
|
|
306
|
-
continue;
|
|
307
|
-
const affectedSourceFile = this._program.getSourceFile(affectedFile);
|
|
308
|
-
if (!affectedSourceFile ||
|
|
309
|
-
(this._ngProgram && this._ngProgram.compiler.ignoreForDiagnostics.has(affectedSourceFile))) {
|
|
310
|
-
continue;
|
|
311
|
-
}
|
|
312
|
-
this._perf.run("개별 파일 진단 수집", () => {
|
|
313
|
-
diagnostics.push(...this._program.getSyntacticDiagnostics(affectedSourceFile), ...this._program.getSemanticDiagnostics(affectedSourceFile));
|
|
314
|
-
});
|
|
315
|
-
if (this._ngProgram) {
|
|
316
|
-
this._perf.run("개별 파일 진단 수집(Angular)", () => {
|
|
317
|
-
if (affectedSourceFile.isDeclarationFile)
|
|
318
|
-
return;
|
|
319
|
-
diagnostics.push(...this._ngProgram.compiler.getDiagnosticsForFile(affectedSourceFile, OptimizeFor.WholeProgram));
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
if (!this._opt.watch?.noEmit) {
|
|
325
|
-
this._perf.run("파일 출력 (emit)", () => {
|
|
326
|
-
this._debug(`파일 출력 준비 중...`);
|
|
327
|
-
let transformers = {};
|
|
328
|
-
if (this._ngProgram) {
|
|
329
|
-
const angularTransfomers = this._ngProgram.compiler.prepareEmit().transformers;
|
|
330
|
-
(transformers.before ??= []).push(...(angularTransfomers.before ?? []));
|
|
331
|
-
(transformers.after ??= []).push(...(angularTransfomers.after ?? []));
|
|
332
|
-
(transformers.afterDeclarations ??= []).push(...(angularTransfomers.afterDeclarations ?? []));
|
|
333
|
-
(transformers.before ??= []).push(replaceBootstrap(() => this._program.getTypeChecker()));
|
|
334
|
-
(transformers.before ??= []).push(createWorkerTransformer((file, importer) => {
|
|
335
|
-
const fullPath = path.resolve(path.dirname(importer), file);
|
|
336
|
-
const relPath = path.relative(path.resolve(this._opt.pkgPath, "src"), fullPath);
|
|
337
|
-
return relPath.replace(/\.ts$/, "").replace(/\\/, "/") + ".js";
|
|
338
|
-
}));
|
|
339
|
-
}
|
|
340
|
-
this._debug(`파일 출력 중...`);
|
|
341
|
-
// affected에 새로 추가된 파일은 포함되지 않는 현상이 있어 sourceFileSet으로 바꿈
|
|
342
|
-
// 비교해보니, 딱히 getSourceFiles라서 더 느려지는것 같지는 않음
|
|
343
|
-
// 그래도 affected로 다시 테스트 (조금이라도 더 빠르게)
|
|
344
|
-
for (const affectedFile of [
|
|
345
|
-
...prepareResult.affectedFileSet,
|
|
346
|
-
...prepareResult.styleAffectedFileSet,
|
|
347
|
-
]) {
|
|
348
|
-
if (affectedFile.endsWith(".scss"))
|
|
349
|
-
continue;
|
|
350
|
-
if (this._emittedFilesCacheMap
|
|
351
|
-
.get(affectedFile)
|
|
352
|
-
?.some((item) => !item.outAbsPath?.endsWith(".css")))
|
|
353
|
-
continue;
|
|
354
|
-
const sf = this._program.getSourceFile(affectedFile);
|
|
355
|
-
if (!sf || sf.isDeclarationFile)
|
|
356
|
-
continue;
|
|
357
|
-
if (this._ngProgram?.compiler.ignoreForEmit.has(sf))
|
|
358
|
-
continue;
|
|
359
|
-
if (this._ngProgram?.compiler.incrementalCompilation.safeToSkipEmit(sf))
|
|
360
|
-
continue;
|
|
361
|
-
// 번들이 아닌 외부패키지는 보통 emit안해도 됨
|
|
362
|
-
// but esbuild를 통해 bundle로 묶어야 하는놈들은 모든 output이 있어야 함.
|
|
363
|
-
if (!this._forBundle && !PathUtils.isChildPath(sf.fileName, this._opt.pkgPath)) {
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
this._program.emit(sf, (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
367
|
-
if (!sourceFiles || sourceFiles.length === 0) {
|
|
368
|
-
prepareResult.compilerHost.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
const sourceFile = ts.getOriginalNode(sourceFiles[0], ts.isSourceFile);
|
|
372
|
-
if (this._ngProgram) {
|
|
373
|
-
if (this._ngProgram.compiler.ignoreForEmit.has(sourceFile))
|
|
374
|
-
return;
|
|
375
|
-
this._ngProgram.compiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);
|
|
376
|
-
}
|
|
377
|
-
const emitFileInfoCaches = this._emittedFilesCacheMap.getOrCreate(PathUtils.norm(sourceFile.fileName), []);
|
|
378
|
-
if (PathUtils.isChildPath(sourceFile.fileName, this._opt.pkgPath)) {
|
|
379
|
-
const real = this._convertOutputToReal(fileName, prepareResult.tsconfig.distPath, text);
|
|
380
|
-
emitFileInfoCaches.push({
|
|
381
|
-
outAbsPath: real.filePath,
|
|
382
|
-
text: this._removeOutputDevModeLine(real.text),
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
else {
|
|
386
|
-
emitFileInfoCaches.push({ text });
|
|
387
|
-
}
|
|
388
|
-
emitFileSet.add(PathUtils.norm(sourceFile.fileName));
|
|
389
|
-
}, undefined, undefined, transformers);
|
|
390
|
-
}
|
|
391
|
-
this._debug(`파일 출력 완료`);
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
return {
|
|
395
|
-
emitFileSet,
|
|
396
|
-
diagnostics,
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
_convertOutputToReal(filePath, distPath, text) {
|
|
400
|
-
let realFilePath = PathUtils.norm(filePath);
|
|
401
|
-
let realText = text;
|
|
402
|
-
const srcRelBasePath = path.resolve(distPath, path.basename(this._opt.pkgPath), "src");
|
|
403
|
-
if (PathUtils.isChildPath(realFilePath, srcRelBasePath)) {
|
|
404
|
-
realFilePath = PathUtils.norm(distPath, path.relative(srcRelBasePath, realFilePath));
|
|
405
|
-
// source map 위치 정확히 찾아가기
|
|
406
|
-
if (filePath.endsWith(".js.map")) {
|
|
407
|
-
const sourceMapContents = JSON.parse(realText);
|
|
408
|
-
sourceMapContents.sources[0] = sourceMapContents.sources[0].slice(6); // remove "../../"
|
|
409
|
-
realText = JSON.stringify(sourceMapContents);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
return { filePath: realFilePath, text: realText };
|
|
413
|
-
}
|
|
414
|
-
_removeOutputDevModeLine(str) {
|
|
415
|
-
return str.replace(/\(\(\) => \{ \(typeof ngDevMode === "undefined" \|\| ngDevMode\) && i0.ɵsetClassDebugInfo\(.*, \{ className: ".*", filePath: ".*", lineNumber: [0-9]* }\); }\)\(\);/, "");
|
|
416
|
-
}
|
|
417
|
-
_debug(...msg) {
|
|
418
|
-
this._logger.debug(`[${path.basename(this._opt.pkgPath)}]`, ...msg);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
-
export interface ISdBuildMessage {
|
|
3
|
-
filePath: TNormPath | undefined;
|
|
4
|
-
line: number | undefined;
|
|
5
|
-
char: number | undefined;
|
|
6
|
-
code: string | undefined;
|
|
7
|
-
severity: "error" | "warning" | "suggestion" | "message";
|
|
8
|
-
message: string;
|
|
9
|
-
type: string | undefined;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
-
import { ISdBuildMessage } from "./ISdBuildMessage";
|
|
3
|
-
export interface ISdBuildResult {
|
|
4
|
-
buildMessages: ISdBuildMessage[];
|
|
5
|
-
watchFileSet: Set<TNormPath>;
|
|
6
|
-
affectedFileSet: Set<TNormPath>;
|
|
7
|
-
emitFileSet: Set<TNormPath>;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ISdBuildMessage } from "./ISdBuildMessage";
|
|
2
|
-
import { TNormPath } from "@simplysm/sd-core-node";
|
|
3
|
-
import { TStylesheetBundlingResult } from "./TStylesheetBundlingResult";
|
|
4
|
-
export interface ISdTsCompilerResult {
|
|
5
|
-
messages: ISdBuildMessage[];
|
|
6
|
-
stylesheetBundlingResultMap: Map<TNormPath, TStylesheetBundlingResult>;
|
|
7
|
-
emittedFilesCacheMap: Map<TNormPath, {
|
|
8
|
-
outAbsPath?: TNormPath;
|
|
9
|
-
text: string;
|
|
10
|
-
}[]>;
|
|
11
|
-
emitFileSet: Set<TNormPath>;
|
|
12
|
-
watchFileSet: Set<TNormPath>;
|
|
13
|
-
affectedFileSet: Set<TNormPath>;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
export type TStylesheetBundlingResult = {
|
|
3
|
-
errors: esbuild.PartialMessage[];
|
|
4
|
-
warnings: esbuild.PartialMessage[];
|
|
5
|
-
contents?: string;
|
|
6
|
-
} | {
|
|
7
|
-
errors: undefined;
|
|
8
|
-
warnings: esbuild.PartialMessage[];
|
|
9
|
-
metafile: esbuild.Metafile;
|
|
10
|
-
outputFiles: esbuild.OutputFile[];
|
|
11
|
-
contents: string;
|
|
12
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface INpmConfig {
|
|
2
|
-
name: string;
|
|
3
|
-
description?: string;
|
|
4
|
-
version: string;
|
|
5
|
-
type?: "module" | "commonjs";
|
|
6
|
-
workspaces?: string[];
|
|
7
|
-
volta?: Record<string, string>;
|
|
8
|
-
dependencies?: Record<string, string>;
|
|
9
|
-
optionalDependencies?: Record<string, string>;
|
|
10
|
-
devDependencies?: Record<string, string>;
|
|
11
|
-
peerDependencies?: Record<string, string>;
|
|
12
|
-
peerDependenciesMeta?: Record<string, {
|
|
13
|
-
optional?: boolean;
|
|
14
|
-
}>;
|
|
15
|
-
resolutions?: Record<string, string>;
|
|
16
|
-
scripts?: Record<string, string>;
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import electronBuilder from "electron-builder";
|
|
2
|
-
export interface ISdProjectConfig {
|
|
3
|
-
packages: Record<string, TSdPackageConfig | undefined>;
|
|
4
|
-
localUpdates?: Record<string, string>;
|
|
5
|
-
postPublish?: TSdPostPublishConfig[];
|
|
6
|
-
}
|
|
7
|
-
export type TSdPackageConfig<T extends "server" | "library" | "client" | unknown = unknown> = T extends "library" ? ISdLibPackageConfig : T extends "server" ? ISdServerPackageConfig : T extends "client" ? ISdClientPackageConfig : ISdLibPackageConfig | ISdServerPackageConfig | ISdClientPackageConfig;
|
|
8
|
-
export interface ISdLibPackageConfig {
|
|
9
|
-
type: "library";
|
|
10
|
-
publish?: "npm";
|
|
11
|
-
polyfills?: string[];
|
|
12
|
-
index?: {
|
|
13
|
-
excludes?: string[];
|
|
14
|
-
} | false;
|
|
15
|
-
dbContext?: string;
|
|
16
|
-
forceProductionMode?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface ISdServerPackageConfig {
|
|
19
|
-
type: "server";
|
|
20
|
-
externals?: string[];
|
|
21
|
-
publish?: ISdLocalDirectoryPublishConfig | ISdFtpPublishConfig;
|
|
22
|
-
configs?: Record<string, any>;
|
|
23
|
-
env?: Record<string, string>;
|
|
24
|
-
forceProductionMode?: boolean;
|
|
25
|
-
pm2?: {
|
|
26
|
-
name?: string;
|
|
27
|
-
ignoreWatchPaths?: string[];
|
|
28
|
-
noInterpreter?: boolean;
|
|
29
|
-
noStartScript?: boolean;
|
|
30
|
-
};
|
|
31
|
-
iis?: {
|
|
32
|
-
nodeExeFilePath?: string;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export interface ISdClientPackageConfig {
|
|
36
|
-
type: "client";
|
|
37
|
-
server?: string | {
|
|
38
|
-
port: number;
|
|
39
|
-
};
|
|
40
|
-
publish?: ISdLocalDirectoryPublishConfig | ISdFtpPublishConfig;
|
|
41
|
-
env?: Record<string, string>;
|
|
42
|
-
configs?: Record<string, any>;
|
|
43
|
-
noLazyRoute?: boolean;
|
|
44
|
-
forceProductionMode?: boolean;
|
|
45
|
-
builder?: {
|
|
46
|
-
web?: ISdClientBuilderWebConfig;
|
|
47
|
-
electron?: ISdClientBuilderElectronConfig;
|
|
48
|
-
capacitor?: ISdClientBuilderCapacitorConfig;
|
|
49
|
-
/** @deprecated */
|
|
50
|
-
cordova?: ISdClientBuilderCordovaConfig;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export interface ISdLocalDirectoryPublishConfig {
|
|
54
|
-
type: "local-directory";
|
|
55
|
-
path: string;
|
|
56
|
-
}
|
|
57
|
-
export interface ISdFtpPublishConfig {
|
|
58
|
-
type: "ftp" | "ftps" | "sftp";
|
|
59
|
-
host: string;
|
|
60
|
-
port?: number;
|
|
61
|
-
path?: string;
|
|
62
|
-
user?: string;
|
|
63
|
-
pass?: string;
|
|
64
|
-
}
|
|
65
|
-
export interface ISdClientBuilderElectronConfig {
|
|
66
|
-
appId: string;
|
|
67
|
-
installerIcon?: string;
|
|
68
|
-
portable?: boolean;
|
|
69
|
-
postInstallScript?: string;
|
|
70
|
-
nsisOptions?: electronBuilder.NsisOptions;
|
|
71
|
-
reinstallDependencies?: string[];
|
|
72
|
-
env?: Record<string, string>;
|
|
73
|
-
}
|
|
74
|
-
export interface ISdClientBuilderWebConfig {
|
|
75
|
-
env?: Record<string, string>;
|
|
76
|
-
}
|
|
77
|
-
/** @deprecated */
|
|
78
|
-
export interface ISdClientBuilderCordovaConfig {
|
|
79
|
-
appId: string;
|
|
80
|
-
appName: string;
|
|
81
|
-
plugins?: string[];
|
|
82
|
-
icon?: string;
|
|
83
|
-
debug?: boolean;
|
|
84
|
-
platform?: {
|
|
85
|
-
browser?: {};
|
|
86
|
-
android?: {
|
|
87
|
-
config?: Record<string, string>;
|
|
88
|
-
bundle?: boolean;
|
|
89
|
-
sign?: {
|
|
90
|
-
keystore: string;
|
|
91
|
-
storePassword: string;
|
|
92
|
-
alias: string;
|
|
93
|
-
password: string;
|
|
94
|
-
keystoreType: string;
|
|
95
|
-
};
|
|
96
|
-
sdkVersion?: number;
|
|
97
|
-
permissions?: {
|
|
98
|
-
name: string;
|
|
99
|
-
maxSdkVersion?: number;
|
|
100
|
-
ignore?: string;
|
|
101
|
-
}[];
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
env?: Record<string, string>;
|
|
105
|
-
browserslist?: string[];
|
|
106
|
-
}
|
|
107
|
-
export interface ISdClientBuilderCapacitorConfig {
|
|
108
|
-
appId: string;
|
|
109
|
-
appName: string;
|
|
110
|
-
plugins?: Record<string, Record<string, unknown> | true>;
|
|
111
|
-
icon?: string;
|
|
112
|
-
debug?: boolean;
|
|
113
|
-
platform?: {
|
|
114
|
-
android?: {
|
|
115
|
-
config?: Record<string, string>;
|
|
116
|
-
bundle?: boolean;
|
|
117
|
-
intentFilters?: {
|
|
118
|
-
action?: string;
|
|
119
|
-
category?: string;
|
|
120
|
-
}[];
|
|
121
|
-
sign?: {
|
|
122
|
-
keystore: string;
|
|
123
|
-
storePassword: string;
|
|
124
|
-
alias: string;
|
|
125
|
-
password: string;
|
|
126
|
-
keystoreType?: string;
|
|
127
|
-
};
|
|
128
|
-
sdkVersion?: number;
|
|
129
|
-
permissions?: {
|
|
130
|
-
name: string;
|
|
131
|
-
maxSdkVersion?: number;
|
|
132
|
-
ignore?: string;
|
|
133
|
-
}[];
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
env?: Record<string, string>;
|
|
137
|
-
browserslist?: string[];
|
|
138
|
-
}
|
|
139
|
-
export type TSdPostPublishConfig = ISdPostPublishScriptConfig;
|
|
140
|
-
export interface ISdPostPublishScriptConfig {
|
|
141
|
-
type: "script";
|
|
142
|
-
cmd: string;
|
|
143
|
-
args: string[];
|
|
144
|
-
}
|