@simplysm/sd-cli 12.16.27 → 13.0.0-beta.12
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,525 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { FsUtils, HashUtils, PathUtils, SdLogger } from "@simplysm/sd-core-node";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import nodeStdLibBrowser from "node-stdlib-browser";
|
|
5
|
-
import nodeStdLibBrowserPlugin from "node-stdlib-browser/helpers/esbuild/plugin";
|
|
6
|
-
import browserslist from "browserslist";
|
|
7
|
-
import { SdNgBundlerContext } from "./SdNgBundlerContext";
|
|
8
|
-
import { MemoryLoadResultCache } from "@angular/build/src/tools/esbuild/load-result-cache";
|
|
9
|
-
import { convertOutputFile, createOutputFile, transformSupportedBrowsersToTargets, } from "@angular/build/src/tools/esbuild/utils";
|
|
10
|
-
import { BuildOutputFileType, } from "@angular/build/src/tools/esbuild/bundler-context";
|
|
11
|
-
import { extractLicenses } from "@angular/build/src/tools/esbuild/license-extractor";
|
|
12
|
-
import { IndexHtmlGenerator, } from "@angular/build/src/utils/index-file/index-html-generator";
|
|
13
|
-
import { CrossOrigin } from "@angular/build/src/builders/application/schema";
|
|
14
|
-
import { augmentAppWithServiceWorkerEsbuild } from "@angular/build/src/utils/service-worker";
|
|
15
|
-
import { createSourcemapIgnorelistPlugin } from "@angular/build/src/tools/esbuild/sourcemap-ignorelist-plugin";
|
|
16
|
-
import { StylesheetPluginFactory } from "@angular/build/src/tools/esbuild/stylesheets/stylesheet-plugin-factory";
|
|
17
|
-
import { SassStylesheetLanguage } from "@angular/build/src/tools/esbuild/stylesheets/sass-language";
|
|
18
|
-
import { CssStylesheetLanguage } from "@angular/build/src/tools/esbuild/stylesheets/css-language";
|
|
19
|
-
import { createCssResourcePlugin } from "@angular/build/src/tools/esbuild/stylesheets/css-resource-plugin";
|
|
20
|
-
import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
|
|
21
|
-
import { createSdNgPlugin } from "./createSdNgPlugin";
|
|
22
|
-
import { SdCliPerformanceTimer } from "../../utils/SdCliPerformanceTimer";
|
|
23
|
-
import nodeModule from "module";
|
|
24
|
-
import { SdWorkerPathPlugin } from "../commons/SdWorkerPathPlugin";
|
|
25
|
-
export class SdNgBundler {
|
|
26
|
-
constructor(_opt, _conf) {
|
|
27
|
-
this._opt = _opt;
|
|
28
|
-
this._conf = _conf;
|
|
29
|
-
this._logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundler"]);
|
|
30
|
-
this._modifiedFileSet = new Set();
|
|
31
|
-
this._ngResultCache = {
|
|
32
|
-
affectedFileSet: new Set(),
|
|
33
|
-
watchFileSet: new Set(),
|
|
34
|
-
};
|
|
35
|
-
this._styleLoadResultCache = new MemoryLoadResultCache();
|
|
36
|
-
this._outputHashCache = new Map();
|
|
37
|
-
this._pkgNpmConf = FsUtils.readJson(path.resolve(this._opt.pkgPath, "package.json"));
|
|
38
|
-
this._mainFilePath = path.resolve(this._opt.pkgPath, "src/main.ts");
|
|
39
|
-
this._tsConfigFilePath = path.resolve(this._opt.pkgPath, "tsconfig.json");
|
|
40
|
-
this._swConfFilePath = path.resolve(this._opt.pkgPath, "ngsw-config.json");
|
|
41
|
-
this._browserTarget = transformSupportedBrowsersToTargets(browserslist(["Chrome > 78"]));
|
|
42
|
-
this._indexHtmlFilePath = path.resolve(this._opt.pkgPath, "src/index.html");
|
|
43
|
-
this._pkgName = path.basename(this._opt.pkgPath);
|
|
44
|
-
this._baseHref =
|
|
45
|
-
this._conf.builderType === "web"
|
|
46
|
-
? `/${this._pkgName}/`
|
|
47
|
-
: this._opt.watch?.dev
|
|
48
|
-
? `/${this._pkgName}/${this._conf.builderType}/`
|
|
49
|
-
: ``;
|
|
50
|
-
this._outputPath =
|
|
51
|
-
this._conf.builderType === "web"
|
|
52
|
-
? PathUtils.norm(this._opt.pkgPath, "dist")
|
|
53
|
-
: this._conf.builderType === "electron" && !this._opt.watch?.dev
|
|
54
|
-
? PathUtils.norm(this._opt.pkgPath, ".electron/src")
|
|
55
|
-
: this._conf.builderType === "cordova" && !this._opt.watch?.dev
|
|
56
|
-
? PathUtils.norm(this._opt.pkgPath, ".cordova/www")
|
|
57
|
-
: this._conf.builderType === "capacitor" && !this._opt.watch?.dev
|
|
58
|
-
? PathUtils.norm(this._opt.pkgPath, ".capacitor/www")
|
|
59
|
-
: PathUtils.norm(this._opt.pkgPath, "dist", this._conf.builderType);
|
|
60
|
-
}
|
|
61
|
-
markForChanges(filePaths) {
|
|
62
|
-
for (const filePath of filePaths) {
|
|
63
|
-
this._modifiedFileSet.add(PathUtils.norm(filePath));
|
|
64
|
-
this._styleLoadResultCache.invalidate(PathUtils.norm(filePath));
|
|
65
|
-
/*if (this.#styleLoadResultCache.invalidate(PathUtils.norm(filePath))) {
|
|
66
|
-
this.#styleLoadResultCache.invalidate(PathUtils.norm(this._opt.pkgPath, "src/styles.scss"));
|
|
67
|
-
}*/
|
|
68
|
-
}
|
|
69
|
-
// this._sourceFileCache.invalidate(filePaths);
|
|
70
|
-
}
|
|
71
|
-
async bundleAsync() {
|
|
72
|
-
const perf = new SdCliPerformanceTimer("ng bundle");
|
|
73
|
-
this._debug(`Preparing build contexts...`);
|
|
74
|
-
if (!this._contexts) {
|
|
75
|
-
this._contexts = perf.run("Preparing build contexts", () => [
|
|
76
|
-
this._getAppContext(),
|
|
77
|
-
...(FsUtils.exists(path.resolve(this._opt.pkgPath, "src/styles.scss"))
|
|
78
|
-
? [this._getStyleContext()]
|
|
79
|
-
: []),
|
|
80
|
-
...(this._conf.builderType === "electron" ? [this._getElectronMainContext()] : []),
|
|
81
|
-
]);
|
|
82
|
-
}
|
|
83
|
-
this._debug("Bundling...");
|
|
84
|
-
const bundlingResults = await perf.run("Bundling", async () => {
|
|
85
|
-
return await this._contexts.parallelAsync(async (ctx) => await ctx.bundleAsync());
|
|
86
|
-
});
|
|
87
|
-
//-- results
|
|
88
|
-
const buildMessages = bundlingResults.mapMany((bundlingResult) => bundlingResult.results);
|
|
89
|
-
if (this._opt.watch?.noEmit) {
|
|
90
|
-
return {
|
|
91
|
-
watchFileSet: this._ngResultCache.watchFileSet,
|
|
92
|
-
affectedFileSet: this._ngResultCache.affectedFileSet,
|
|
93
|
-
buildMessages,
|
|
94
|
-
emitFileSet: new Set(),
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
this._debug(`Converting build results...`);
|
|
99
|
-
const outputFiles = bundlingResults.mapMany((item) => item.outputFiles?.map((file) => convertOutputFile(file, BuildOutputFileType.Root)) ?? []);
|
|
100
|
-
const initialFiles = new Map();
|
|
101
|
-
const metafile = {
|
|
102
|
-
inputs: {},
|
|
103
|
-
outputs: {},
|
|
104
|
-
};
|
|
105
|
-
for (const bundlingResult of bundlingResults) {
|
|
106
|
-
bundlingResult.initialFiles.forEach((v, k) => initialFiles.set(k, v));
|
|
107
|
-
metafile.inputs = { ...metafile.inputs, ...bundlingResult.metafile?.inputs };
|
|
108
|
-
metafile.outputs = { ...metafile.outputs, ...bundlingResult.metafile?.outputs };
|
|
109
|
-
}
|
|
110
|
-
//-- cordova empty
|
|
111
|
-
/*if (this._opt.builderType === "cordova" && this._opt.cordovaConfig?.plugins) {
|
|
112
|
-
outputFiles.push(createOutputFile("cordova-empty.js", "export default {};", BuildOutputFileType.Root));
|
|
113
|
-
}*/
|
|
114
|
-
this._debug(`Generating index.html...`);
|
|
115
|
-
await perf.run("Generating index.html", async () => {
|
|
116
|
-
const genIndexHtmlResult = await this._genIndexHtmlAsync(outputFiles, initialFiles);
|
|
117
|
-
for (const warning of genIndexHtmlResult.warnings) {
|
|
118
|
-
buildMessages.push({
|
|
119
|
-
filePath: undefined,
|
|
120
|
-
line: undefined,
|
|
121
|
-
char: undefined,
|
|
122
|
-
code: undefined,
|
|
123
|
-
severity: "warning",
|
|
124
|
-
message: `${warning}`,
|
|
125
|
-
type: "gen-index",
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
for (const error of genIndexHtmlResult.errors) {
|
|
129
|
-
buildMessages.push({
|
|
130
|
-
filePath: undefined,
|
|
131
|
-
line: undefined,
|
|
132
|
-
char: undefined,
|
|
133
|
-
code: undefined,
|
|
134
|
-
severity: "error",
|
|
135
|
-
message: `${error}`,
|
|
136
|
-
type: "gen-index",
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
outputFiles.push(createOutputFile("index.html", genIndexHtmlResult.csrContent, BuildOutputFileType.Root));
|
|
140
|
-
});
|
|
141
|
-
this._debug(`Processing assets...`);
|
|
142
|
-
const assetFiles = [];
|
|
143
|
-
await perf.run("Processing assets", async () => {
|
|
144
|
-
//-- copy assets
|
|
145
|
-
assetFiles.push(...(await this._copyAssetsAsync()));
|
|
146
|
-
//-- extract 3rdpartylicenses
|
|
147
|
-
if (!this._opt.watch?.dev) {
|
|
148
|
-
outputFiles.push(createOutputFile("3rdpartylicenses.txt", await extractLicenses(metafile, this._opt.pkgPath), BuildOutputFileType.Root));
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
//-- service worker
|
|
152
|
-
if (FsUtils.exists(this._swConfFilePath) && !this._opt.watch?.dev) {
|
|
153
|
-
this._debug(`Preparing service worker...`);
|
|
154
|
-
await perf.run("Preparing service worker", async () => {
|
|
155
|
-
try {
|
|
156
|
-
const serviceWorkerResult = await this._genServiceWorkerAsync(outputFiles, assetFiles);
|
|
157
|
-
outputFiles.push(createOutputFile("ngsw.json", serviceWorkerResult.manifest, BuildOutputFileType.Root));
|
|
158
|
-
assetFiles.push(...serviceWorkerResult.assetFiles);
|
|
159
|
-
}
|
|
160
|
-
catch (err) {
|
|
161
|
-
buildMessages.push({
|
|
162
|
-
filePath: undefined,
|
|
163
|
-
line: undefined,
|
|
164
|
-
char: undefined,
|
|
165
|
-
code: undefined,
|
|
166
|
-
severity: "error",
|
|
167
|
-
message: `${err.toString()}`,
|
|
168
|
-
type: "gen-sw",
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
//-- write
|
|
174
|
-
this._debug(`Writing output files...(${outputFiles.length})`);
|
|
175
|
-
const emitFileSet = new Set();
|
|
176
|
-
await perf.run("Writing output file", async () => {
|
|
177
|
-
const allOutputFiles = outputFiles
|
|
178
|
-
.map((item) => ({
|
|
179
|
-
path: PathUtils.norm(this._outputPath, item.path),
|
|
180
|
-
contents: item.contents,
|
|
181
|
-
hash: item.hash,
|
|
182
|
-
}))
|
|
183
|
-
.concat(await assetFiles.parallelAsync(async (item) => {
|
|
184
|
-
const contents = await FsUtils.readFileBufferAsync(item.source);
|
|
185
|
-
return {
|
|
186
|
-
path: PathUtils.norm(this._outputPath, item.destination),
|
|
187
|
-
contents,
|
|
188
|
-
hash: HashUtils.get(contents),
|
|
189
|
-
};
|
|
190
|
-
}));
|
|
191
|
-
for (const outputFile of allOutputFiles) {
|
|
192
|
-
const prevHash = this._outputHashCache.get(outputFile.path);
|
|
193
|
-
if (prevHash !== outputFile.hash) {
|
|
194
|
-
await FsUtils.writeFileAsync(outputFile.path, outputFile.contents);
|
|
195
|
-
this._outputHashCache.set(outputFile.path, outputFile.hash);
|
|
196
|
-
emitFileSet.add(outputFile.path);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
/*await Promise.all([
|
|
200
|
-
outputFiles.parallelAsync(async (outputFile) => {
|
|
201
|
-
const distFilePath = PathUtils.norm(this.#outputPath, outputFile.path);
|
|
202
|
-
const prevHash = this.#outputHashCache.get(distFilePath);
|
|
203
|
-
const currHash = HashUtils.get(Buffer.from(outputFile.contents));
|
|
204
|
-
if (prevHash !== currHash) {
|
|
205
|
-
await FsUtils.writeFileAsync(distFilePath, outputFile.contents);
|
|
206
|
-
this.#outputHashCache.set(distFilePath, currHash);
|
|
207
|
-
emitFileSet.add(distFilePath);
|
|
208
|
-
}
|
|
209
|
-
}),
|
|
210
|
-
assetFiles.parallelAsync(async (assetFile) => {
|
|
211
|
-
const prevHash = this.#outputHashCache.get(PathUtils.norm(assetFile.source));
|
|
212
|
-
const currHash = HashUtils.get(await FsUtils.readFileBufferAsync(assetFile.source));
|
|
213
|
-
if (prevHash !== currHash) {
|
|
214
|
-
await FsUtils.copyAsync(
|
|
215
|
-
assetFile.source,
|
|
216
|
-
path.resolve(this.#outputPath, assetFile.destination),
|
|
217
|
-
);
|
|
218
|
-
this.#outputHashCache.set(PathUtils.norm(assetFile.source), currHash);
|
|
219
|
-
emitFileSet.add(PathUtils.norm(this.#outputPath, assetFile.destination));
|
|
220
|
-
}
|
|
221
|
-
}),
|
|
222
|
-
]);*/
|
|
223
|
-
});
|
|
224
|
-
this._debug(`Build performance summary:\n${perf.toString()}`);
|
|
225
|
-
return {
|
|
226
|
-
watchFileSet: new Set([
|
|
227
|
-
...this._ngResultCache.watchFileSet,
|
|
228
|
-
...this._styleLoadResultCache.watchFiles.map((item) => PathUtils.norm(item)),
|
|
229
|
-
...assetFiles.map((item) => PathUtils.norm(item.source)),
|
|
230
|
-
PathUtils.norm(this._indexHtmlFilePath),
|
|
231
|
-
]),
|
|
232
|
-
affectedFileSet: this._ngResultCache.affectedFileSet,
|
|
233
|
-
buildMessages,
|
|
234
|
-
emitFileSet: emitFileSet,
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
async _genIndexHtmlAsync(outputFiles, initialFiles) {
|
|
239
|
-
const readAsset = (filePath) => {
|
|
240
|
-
const relFilePath = path.relative("/", filePath);
|
|
241
|
-
const currFile = outputFiles.find((outputFile) => outputFile.path === relFilePath);
|
|
242
|
-
if (currFile) {
|
|
243
|
-
return Promise.resolve(currFile.text);
|
|
244
|
-
}
|
|
245
|
-
throw new Error(`Output file does not exist: ${relFilePath}`);
|
|
246
|
-
};
|
|
247
|
-
const indexHtmlGenerator = new IndexHtmlGenerator({
|
|
248
|
-
indexPath: this._indexHtmlFilePath,
|
|
249
|
-
entrypoints: [
|
|
250
|
-
["polyfills", true],
|
|
251
|
-
["styles", false],
|
|
252
|
-
["main", true],
|
|
253
|
-
...(this._conf.builderType === "cordova" ? [["cordova-entry", true]] : []),
|
|
254
|
-
],
|
|
255
|
-
sri: false,
|
|
256
|
-
optimization: {
|
|
257
|
-
scripts: !this._opt.watch?.dev,
|
|
258
|
-
styles: {
|
|
259
|
-
minify: !this._opt.watch?.dev,
|
|
260
|
-
inlineCritical: !this._opt.watch?.dev,
|
|
261
|
-
removeSpecialComments: !this._opt.watch?.dev,
|
|
262
|
-
},
|
|
263
|
-
fonts: { inline: !this._opt.watch?.dev },
|
|
264
|
-
},
|
|
265
|
-
crossOrigin: CrossOrigin.None,
|
|
266
|
-
generateDedicatedSSRContent: false,
|
|
267
|
-
});
|
|
268
|
-
indexHtmlGenerator.readAsset = readAsset;
|
|
269
|
-
const modulePreloads = [];
|
|
270
|
-
const hints = [];
|
|
271
|
-
if (!this._opt.watch?.dev) {
|
|
272
|
-
for (const [key, value] of initialFiles) {
|
|
273
|
-
if (value.entrypoint || value.serverFile) {
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
if (value.type === "script") {
|
|
277
|
-
modulePreloads.push({ url: key, mode: "modulepreload", depth: value.depth });
|
|
278
|
-
}
|
|
279
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
280
|
-
else if (value.type === "style") {
|
|
281
|
-
hints.push({ url: key, mode: "preload", as: "style" });
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
modulePreloads.sort((a, b) => a.depth - b.depth);
|
|
285
|
-
hints.push(...modulePreloads.slice(0, 10));
|
|
286
|
-
}
|
|
287
|
-
return await indexHtmlGenerator.process({
|
|
288
|
-
baseHref: this._baseHref,
|
|
289
|
-
lang: undefined,
|
|
290
|
-
outputPath: "/",
|
|
291
|
-
files: [...initialFiles].map(([file, record]) => ({
|
|
292
|
-
name: record.name ?? "",
|
|
293
|
-
file,
|
|
294
|
-
extension: path.extname(file),
|
|
295
|
-
})),
|
|
296
|
-
hints,
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
async _copyAssetsAsync() {
|
|
300
|
-
return await resolveAssets([
|
|
301
|
-
{ input: "public", glob: "**/*", output: "." },
|
|
302
|
-
...(this._opt.watch?.dev ? [{ input: "public-dev", glob: "**/*", output: "." }] : []),
|
|
303
|
-
...(this._opt.watch?.dev && this._conf.builderType === "cordova"
|
|
304
|
-
? Object.keys(this._conf.builderConfig?.platform ?? { browser: {} }).mapMany((platform) => [
|
|
305
|
-
{
|
|
306
|
-
input: `.cordova/platforms/${platform}/platform_www/plugins`,
|
|
307
|
-
glob: "**/*",
|
|
308
|
-
output: `cordova-${platform}/plugins`,
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
input: `.cordova/platforms/${platform}/platform_www`,
|
|
312
|
-
glob: "cordova.js",
|
|
313
|
-
output: `cordova-${platform}`,
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
input: `.cordova/platforms/${platform}/platform_www`,
|
|
317
|
-
glob: "cordova_plugins.js",
|
|
318
|
-
output: `cordova-${platform}`,
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
input: `.cordova/platforms/${platform}/www`,
|
|
322
|
-
glob: "config.xml",
|
|
323
|
-
output: `cordova-${platform}`,
|
|
324
|
-
},
|
|
325
|
-
])
|
|
326
|
-
: []),
|
|
327
|
-
], this._opt.pkgPath);
|
|
328
|
-
}
|
|
329
|
-
async _genServiceWorkerAsync(outputFiles, assetFiles) {
|
|
330
|
-
return await augmentAppWithServiceWorkerEsbuild(this._opt.pkgPath, this._swConfFilePath, this._baseHref, "index.html", outputFiles, assetFiles);
|
|
331
|
-
}
|
|
332
|
-
_getAppContext() {
|
|
333
|
-
/*const workerEntries = (
|
|
334
|
-
await FsUtils.globAsync(path.resolve(this._opt.pkgPath, "src/workers/!*.ts"))
|
|
335
|
-
).toObject((p) => "workers/" + path.basename(p, path.extname(p)));*/
|
|
336
|
-
return new SdNgBundlerContext(this._opt.pkgPath, !!this._opt.watch, {
|
|
337
|
-
absWorkingDir: this._opt.pkgPath,
|
|
338
|
-
bundle: true,
|
|
339
|
-
keepNames: true,
|
|
340
|
-
assetNames: "media/[name]",
|
|
341
|
-
conditions: ["es2020", "es2015", "module"],
|
|
342
|
-
resolveExtensions: [".js", ".mjs", ".cjs", ".ts"],
|
|
343
|
-
metafile: true,
|
|
344
|
-
legalComments: this._opt.watch?.dev ? "eof" : "none",
|
|
345
|
-
logLevel: "silent",
|
|
346
|
-
minifyIdentifiers: !this._opt.watch?.dev,
|
|
347
|
-
minifySyntax: !this._opt.watch?.dev,
|
|
348
|
-
minifyWhitespace: !this._opt.watch?.dev,
|
|
349
|
-
pure: ["forwardRef"],
|
|
350
|
-
outdir: this._opt.pkgPath,
|
|
351
|
-
outExtension: undefined,
|
|
352
|
-
sourcemap: !!this._opt.watch?.dev,
|
|
353
|
-
chunkNames: "[name]-[hash]",
|
|
354
|
-
tsconfig: this._tsConfigFilePath,
|
|
355
|
-
write: false,
|
|
356
|
-
preserveSymlinks: false,
|
|
357
|
-
define: {
|
|
358
|
-
...(!this._opt.watch?.dev ? { ngDevMode: "false" } : {}),
|
|
359
|
-
"ngJitMode": "false",
|
|
360
|
-
"global": "global",
|
|
361
|
-
"process": "process",
|
|
362
|
-
"Buffer": "Buffer",
|
|
363
|
-
"process.env.SD_VERSION": JSON.stringify(this._pkgNpmConf.version),
|
|
364
|
-
"process.env.NODE_ENV": JSON.stringify(this._opt.watch?.dev ? "development" : "production"),
|
|
365
|
-
...(this._conf.env
|
|
366
|
-
? Object.keys(this._conf.env).toObject((key) => `process.env.${key}`, (key) => JSON.stringify(this._conf.env[key]))
|
|
367
|
-
: {}),
|
|
368
|
-
},
|
|
369
|
-
mainFields: ["es2020", "es2015", "browser", "module", "main"],
|
|
370
|
-
entryNames: "[dir]/[name]",
|
|
371
|
-
entryPoints: {
|
|
372
|
-
main: this._mainFilePath,
|
|
373
|
-
...(FsUtils.exists(path.resolve(this._opt.pkgPath, "src/polyfills.ts"))
|
|
374
|
-
? {
|
|
375
|
-
polyfills: path.resolve(this._opt.pkgPath, "src/polyfills.ts"),
|
|
376
|
-
}
|
|
377
|
-
: {}),
|
|
378
|
-
...(this._conf.builderType === "cordova"
|
|
379
|
-
? {
|
|
380
|
-
"cordova-entry": path.resolve(path.dirname(fileURLToPath(import.meta.url)), `../../../lib/cordova-entry.js`),
|
|
381
|
-
}
|
|
382
|
-
: {}),
|
|
383
|
-
// ...workerEntries,
|
|
384
|
-
},
|
|
385
|
-
supported: { "async-await": false, "object-rest-spread": false },
|
|
386
|
-
loader: {
|
|
387
|
-
".png": "file",
|
|
388
|
-
".jpeg": "file",
|
|
389
|
-
".jpg": "file",
|
|
390
|
-
".jfif": "file",
|
|
391
|
-
".gif": "file",
|
|
392
|
-
".svg": "file",
|
|
393
|
-
".woff": "file",
|
|
394
|
-
".woff2": "file",
|
|
395
|
-
".ttf": "file",
|
|
396
|
-
".ttc": "file",
|
|
397
|
-
".eot": "file",
|
|
398
|
-
".ico": "file",
|
|
399
|
-
".otf": "file",
|
|
400
|
-
".csv": "file",
|
|
401
|
-
".xlsx": "file",
|
|
402
|
-
".xls": "file",
|
|
403
|
-
".pptx": "file",
|
|
404
|
-
".ppt": "file",
|
|
405
|
-
".docx": "file",
|
|
406
|
-
".doc": "file",
|
|
407
|
-
".zip": "file",
|
|
408
|
-
".pfx": "file",
|
|
409
|
-
".pkl": "file",
|
|
410
|
-
".mp3": "file",
|
|
411
|
-
".ogg": "file",
|
|
412
|
-
},
|
|
413
|
-
...(this._conf.builderType === "electron"
|
|
414
|
-
? {
|
|
415
|
-
platform: "node",
|
|
416
|
-
target: "node20",
|
|
417
|
-
external: [
|
|
418
|
-
"electron",
|
|
419
|
-
...nodeModule.builtinModules,
|
|
420
|
-
...(this._conf.builderConfig?.reinstallDependencies ?? []),
|
|
421
|
-
],
|
|
422
|
-
}
|
|
423
|
-
: {
|
|
424
|
-
platform: "browser",
|
|
425
|
-
target: this._browserTarget,
|
|
426
|
-
format: "esm",
|
|
427
|
-
splitting: true,
|
|
428
|
-
inject: [
|
|
429
|
-
PathUtils.posix(fileURLToPath(import.meta.resolve("node-stdlib-browser/helpers/esbuild/shim"))),
|
|
430
|
-
],
|
|
431
|
-
}),
|
|
432
|
-
plugins: [
|
|
433
|
-
createSourcemapIgnorelistPlugin(),
|
|
434
|
-
createSdNgPlugin(this._opt, this._modifiedFileSet, this._ngResultCache),
|
|
435
|
-
...(this._conf.builderType === "electron"
|
|
436
|
-
? []
|
|
437
|
-
: [nodeStdLibBrowserPlugin(nodeStdLibBrowser)]),
|
|
438
|
-
SdWorkerPathPlugin(this._outputPath),
|
|
439
|
-
// {
|
|
440
|
-
// name: "log-circular",
|
|
441
|
-
// setup(build) {
|
|
442
|
-
// build.onEnd(result => {
|
|
443
|
-
// if (result.metafile) {
|
|
444
|
-
// const analysis = esbuild.analyzeMetafile(result.metafile);
|
|
445
|
-
// console.log(analysis);
|
|
446
|
-
// }
|
|
447
|
-
// });
|
|
448
|
-
// },
|
|
449
|
-
// },
|
|
450
|
-
],
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
_getStyleContext() {
|
|
454
|
-
const pluginFactory = new StylesheetPluginFactory({
|
|
455
|
-
sourcemap: !!this._opt.watch?.dev,
|
|
456
|
-
includePaths: [],
|
|
457
|
-
}, this._styleLoadResultCache);
|
|
458
|
-
return new SdNgBundlerContext(this._opt.pkgPath, !!this._opt.watch, {
|
|
459
|
-
absWorkingDir: this._opt.pkgPath,
|
|
460
|
-
bundle: true,
|
|
461
|
-
entryNames: "[name]",
|
|
462
|
-
assetNames: "media/[name]",
|
|
463
|
-
logLevel: "silent",
|
|
464
|
-
minify: !this._opt.watch?.dev,
|
|
465
|
-
metafile: true,
|
|
466
|
-
sourcemap: !!this._opt.watch?.dev,
|
|
467
|
-
outdir: this._opt.pkgPath,
|
|
468
|
-
write: false,
|
|
469
|
-
platform: "browser",
|
|
470
|
-
target: this._browserTarget,
|
|
471
|
-
preserveSymlinks: false,
|
|
472
|
-
external: [],
|
|
473
|
-
conditions: ["style", "sass"],
|
|
474
|
-
mainFields: ["style", "sass"],
|
|
475
|
-
legalComments: !this._opt.watch?.dev ? "none" : "eof",
|
|
476
|
-
entryPoints: {
|
|
477
|
-
styles: path.resolve(this._opt.pkgPath, "src/styles.scss"),
|
|
478
|
-
},
|
|
479
|
-
plugins: [
|
|
480
|
-
pluginFactory.create(SassStylesheetLanguage),
|
|
481
|
-
pluginFactory.create(CssStylesheetLanguage),
|
|
482
|
-
createCssResourcePlugin(this._styleLoadResultCache),
|
|
483
|
-
],
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
_getElectronMainContext() {
|
|
487
|
-
return new SdNgBundlerContext(this._opt.pkgPath, !!this._opt.watch, {
|
|
488
|
-
absWorkingDir: this._opt.pkgPath,
|
|
489
|
-
bundle: true,
|
|
490
|
-
entryNames: "[name]",
|
|
491
|
-
assetNames: "media/[name]",
|
|
492
|
-
conditions: ["es2020", "es2015", "module"],
|
|
493
|
-
resolveExtensions: [".js", ".mjs", ".cjs", ".ts"],
|
|
494
|
-
metafile: true,
|
|
495
|
-
legalComments: this._opt.watch?.dev ? "eof" : "none",
|
|
496
|
-
logLevel: "silent",
|
|
497
|
-
minify: !this._opt.watch?.dev,
|
|
498
|
-
outdir: this._opt.pkgPath,
|
|
499
|
-
sourcemap: !!this._opt.watch?.dev,
|
|
500
|
-
tsconfig: this._tsConfigFilePath,
|
|
501
|
-
write: false,
|
|
502
|
-
preserveSymlinks: false,
|
|
503
|
-
external: [
|
|
504
|
-
"electron",
|
|
505
|
-
...nodeModule.builtinModules,
|
|
506
|
-
...(this._conf.builderConfig?.reinstallDependencies ?? []),
|
|
507
|
-
],
|
|
508
|
-
define: {
|
|
509
|
-
...(!this._opt.watch?.dev ? { ngDevMode: "false" } : {}),
|
|
510
|
-
"process.env.SD_VERSION": JSON.stringify(this._pkgNpmConf.version),
|
|
511
|
-
"process.env.NODE_ENV": JSON.stringify(this._opt.watch?.dev ? "development" : "production"),
|
|
512
|
-
...(this._conf.env
|
|
513
|
-
? Object.keys(this._conf.env).toObject((key) => `process.env.${key}`, (key) => JSON.stringify(this._conf.env[key]))
|
|
514
|
-
: {}),
|
|
515
|
-
},
|
|
516
|
-
platform: "node",
|
|
517
|
-
entryPoints: {
|
|
518
|
-
"electron-main": path.resolve(this._opt.pkgPath, "src/electron-main.ts"),
|
|
519
|
-
},
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
_debug(...msg) {
|
|
523
|
-
this._logger.debug(`[${path.basename(this._opt.pkgPath)}]`, ...msg);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
interface InitialFileRecord {
|
|
3
|
-
entrypoint: boolean;
|
|
4
|
-
name?: string;
|
|
5
|
-
type: "script" | "style";
|
|
6
|
-
external?: boolean;
|
|
7
|
-
serverFile: boolean;
|
|
8
|
-
depth: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class SdNgBundlerContext {
|
|
11
|
-
private readonly _pkgPath;
|
|
12
|
-
private readonly _watch;
|
|
13
|
-
private readonly _esbuildOptions;
|
|
14
|
-
private readonly _logger;
|
|
15
|
-
private _context?;
|
|
16
|
-
constructor(_pkgPath: string, _watch: boolean, _esbuildOptions: esbuild.BuildOptions);
|
|
17
|
-
bundleAsync(): Promise<{
|
|
18
|
-
results: import("../../types/build/ISdBuildMessage").ISdBuildMessage[];
|
|
19
|
-
initialFiles: Map<string, InitialFileRecord>;
|
|
20
|
-
outputFiles: esbuild.OutputFile[] | undefined;
|
|
21
|
-
metafile: esbuild.Metafile | undefined;
|
|
22
|
-
}>;
|
|
23
|
-
private _debug;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { SdLogger } from "@simplysm/sd-core-node";
|
|
4
|
-
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
5
|
-
export class SdNgBundlerContext {
|
|
6
|
-
constructor(_pkgPath, _watch, _esbuildOptions) {
|
|
7
|
-
this._pkgPath = _pkgPath;
|
|
8
|
-
this._watch = _watch;
|
|
9
|
-
this._esbuildOptions = _esbuildOptions;
|
|
10
|
-
this._logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundlerContext"]);
|
|
11
|
-
}
|
|
12
|
-
async bundleAsync() {
|
|
13
|
-
let esbuildResult;
|
|
14
|
-
this._debug(`Building...`);
|
|
15
|
-
if (this._watch) {
|
|
16
|
-
if (this._context == null) {
|
|
17
|
-
this._context = await esbuild.context(this._esbuildOptions);
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
esbuildResult = await this._context.rebuild();
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
if ("warnings" in err || "errors" in err) {
|
|
24
|
-
esbuildResult = err;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
throw err;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
try {
|
|
33
|
-
esbuildResult = await esbuild.build(this._esbuildOptions);
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
if ("warnings" in err || "errors" in err) {
|
|
37
|
-
esbuildResult = err;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
throw err;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
this._debug(`Build completed`);
|
|
45
|
-
this._debug(`Converting results...`);
|
|
46
|
-
const results = SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(esbuildResult, this._pkgPath);
|
|
47
|
-
const initialFiles = new Map();
|
|
48
|
-
for (const outputFile of esbuildResult.outputFiles ?? []) {
|
|
49
|
-
const relativeFilePath = path.isAbsolute(outputFile.path)
|
|
50
|
-
? path.relative(this._pkgPath, outputFile.path)
|
|
51
|
-
: outputFile.path;
|
|
52
|
-
const entryPoint = esbuildResult.metafile?.outputs[relativeFilePath]?.entryPoint;
|
|
53
|
-
outputFile.path = relativeFilePath;
|
|
54
|
-
if (entryPoint != null) {
|
|
55
|
-
const name = path.basename(relativeFilePath).split(".", 1)[0];
|
|
56
|
-
const type = path.extname(relativeFilePath) === ".css" ? "style" : "script";
|
|
57
|
-
if (this._esbuildOptions.entryPoints?.[name] != null) {
|
|
58
|
-
initialFiles.set(relativeFilePath, {
|
|
59
|
-
name,
|
|
60
|
-
type,
|
|
61
|
-
entrypoint: true,
|
|
62
|
-
serverFile: false,
|
|
63
|
-
depth: 0,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const files = [...initialFiles.keys()];
|
|
69
|
-
for (const file of files) {
|
|
70
|
-
const entryRecord = initialFiles.get(file);
|
|
71
|
-
for (const initialImport of esbuildResult.metafile?.outputs[file]?.imports ?? []) {
|
|
72
|
-
const existingRecord = initialFiles.get(initialImport.path);
|
|
73
|
-
if (existingRecord) {
|
|
74
|
-
if (existingRecord.depth > entryRecord.depth + 1) {
|
|
75
|
-
existingRecord.depth = entryRecord.depth + 1;
|
|
76
|
-
}
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (initialImport.kind === "import-statement" || initialImport.kind === "import-rule") {
|
|
80
|
-
const record = {
|
|
81
|
-
type: initialImport.kind === "import-rule" ? "style" : "script",
|
|
82
|
-
entrypoint: false,
|
|
83
|
-
external: initialImport.external,
|
|
84
|
-
serverFile: false,
|
|
85
|
-
depth: entryRecord.depth + 1,
|
|
86
|
-
};
|
|
87
|
-
initialFiles.set(initialImport.path, record);
|
|
88
|
-
if (!initialImport.external) {
|
|
89
|
-
files.push(initialImport.path);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
results,
|
|
96
|
-
initialFiles,
|
|
97
|
-
outputFiles: esbuildResult.outputFiles,
|
|
98
|
-
metafile: esbuildResult.metafile,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
_debug(...msg) {
|
|
102
|
-
this._logger.debug(`[${path.basename(this._pkgPath)}] (${Object.keys(this._esbuildOptions.entryPoints).join(", ")})`, ...msg);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import { TNormPath } from "@simplysm/sd-core-node";
|
|
3
|
-
import { ISdCliNgPluginResultCache } from "../../types/plugin/ISdCliNgPluginResultCache";
|
|
4
|
-
import { ISdTsCompilerOptions } from "../../types/build/ISdTsCompilerOptions";
|
|
5
|
-
export declare function createSdNgPlugin(opt: ISdTsCompilerOptions, modifiedFileSet: Set<TNormPath>, resultCache: ISdCliNgPluginResultCache): esbuild.Plugin;
|