tnp-helpers 18.0.19 → 18.0.21
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/README.md +24 -24
- package/browser/esm2022/lib/base/classes/base-bower-json.mjs +14 -0
- package/browser/esm2022/lib/base/classes/base-cli-worker-config.mjs +1 -4
- package/browser/esm2022/lib/base/classes/base-cli-worker-controller.mjs +1 -1
- package/browser/esm2022/lib/base/classes/base-cli-worker.mjs +14 -4
- package/browser/esm2022/lib/base/classes/base-debounce-compiler-for-project.mjs +5 -5
- package/browser/esm2022/lib/base/classes/base-feature-for-project.mjs +4 -1
- package/browser/esm2022/lib/base/classes/base-git.mjs +244 -4
- package/browser/esm2022/lib/base/classes/base-json-file-reader.mjs +114 -0
- package/browser/esm2022/lib/base/classes/base-library-build.mjs +35 -10
- package/browser/esm2022/lib/base/classes/base-linked-projects.mjs +8 -5
- package/browser/esm2022/lib/base/classes/base-node-modules.mjs +495 -0
- package/browser/esm2022/lib/base/classes/base-npm-helpers.mjs +32 -430
- package/browser/esm2022/lib/base/classes/base-package-json.mjs +340 -0
- package/browser/esm2022/lib/base/classes/base-process-manager.mjs +285 -0
- package/browser/esm2022/lib/base/classes/base-project-resolver.mjs +2 -11
- package/browser/esm2022/lib/base/classes/base-project.mjs +83 -87
- package/browser/esm2022/lib/base/classes/base-quick-fixes.mjs +44 -1
- package/browser/esm2022/lib/base/classes/base-release-process.mjs +34 -36
- package/browser/esm2022/lib/base/classes/{base-github-pages.mjs → base-static-pages.mjs} +6 -6
- package/browser/esm2022/lib/base/classes/base-vscode.mjs +31 -1
- package/browser/esm2022/lib/base/classes/index.mjs +5 -1
- package/browser/esm2022/lib/base/commit-data.mjs +21 -4
- package/browser/esm2022/lib/base/core-project.mjs +3 -3
- package/browser/esm2022/lib/base/linked-project.mjs +4 -4
- package/browser/esm2022/lib/base/tcp-udp-ports/tcp-udp-ports.context.mjs +2 -4
- package/browser/esm2022/lib/base/translate.mjs +566 -0
- package/browser/esm2022/lib/helpers/helpers-array-obj.mjs +5 -10
- package/browser/esm2022/lib/helpers/helpers.mjs +12 -6
- package/browser/esm2022/lib/index.mjs +2 -4
- package/browser/esm2022/lib/models.mjs +173 -3
- package/browser/esm2022/lib/utils.mjs +402 -41
- package/browser/fesm2022/tnp-helpers.mjs +4616 -2904
- package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
- package/browser/lib/base/classes/base-bower-json.d.ts +35 -0
- package/browser/lib/base/classes/base-cli-worker.d.ts +2 -2
- package/browser/lib/base/classes/base-debounce-compiler-for-project.d.ts +5 -5
- package/browser/lib/base/classes/base-feature-for-project.d.ts +2 -1
- package/browser/lib/base/classes/base-git.d.ts +42 -5
- package/browser/lib/base/classes/base-json-file-reader.d.ts +72 -0
- package/browser/lib/base/classes/base-library-build.d.ts +8 -11
- package/browser/lib/base/classes/base-linked-projects.d.ts +1 -2
- package/browser/lib/base/classes/base-node-modules.d.ts +56 -0
- package/browser/lib/base/classes/base-npm-helpers.d.ts +29 -108
- package/browser/lib/base/classes/base-package-json.d.ts +107 -0
- package/browser/lib/base/classes/base-process-manager.d.ts +31 -0
- package/browser/lib/base/classes/base-project-resolver.d.ts +2 -2
- package/browser/lib/base/classes/base-project.d.ts +17 -18
- package/browser/lib/base/classes/base-quick-fixes.d.ts +3 -1
- package/browser/lib/base/classes/base-release-process.d.ts +15 -13
- package/browser/lib/base/classes/{base-github-pages.d.ts → base-static-pages.d.ts} +3 -3
- package/browser/lib/base/classes/base-vscode.d.ts +4 -0
- package/browser/lib/base/classes/index.d.ts +5 -1
- package/browser/lib/base/commit-data.d.ts +14 -1
- package/browser/lib/base/core-project.d.ts +1 -1
- package/browser/lib/base/linked-project.d.ts +1 -1
- package/browser/lib/base/tcp-udp-ports/ports.entity.d.ts +1 -1
- package/browser/lib/base/translate.d.ts +228 -0
- package/browser/lib/helpers/helpers-array-obj.d.ts +3 -0
- package/browser/lib/helpers/helpers.d.ts +12 -8
- package/browser/lib/index.d.ts +1 -3
- package/browser/lib/models.d.ts +68 -8
- package/browser/lib/utils.d.ts +72 -13
- package/client/README.md +24 -24
- package/client/esm2022/lib/base/classes/base-bower-json.mjs +14 -0
- package/client/esm2022/lib/base/classes/base-cli-worker-config.mjs +1 -4
- package/client/esm2022/lib/base/classes/base-cli-worker-controller.mjs +1 -1
- package/client/esm2022/lib/base/classes/base-cli-worker.mjs +14 -4
- package/client/esm2022/lib/base/classes/base-debounce-compiler-for-project.mjs +5 -5
- package/client/esm2022/lib/base/classes/base-feature-for-project.mjs +4 -1
- package/client/esm2022/lib/base/classes/base-git.mjs +244 -4
- package/client/esm2022/lib/base/classes/base-json-file-reader.mjs +114 -0
- package/client/esm2022/lib/base/classes/base-library-build.mjs +35 -10
- package/client/esm2022/lib/base/classes/base-linked-projects.mjs +8 -5
- package/client/esm2022/lib/base/classes/base-node-modules.mjs +495 -0
- package/client/esm2022/lib/base/classes/base-npm-helpers.mjs +32 -430
- package/client/esm2022/lib/base/classes/base-package-json.mjs +340 -0
- package/client/esm2022/lib/base/classes/base-process-manager.mjs +285 -0
- package/client/esm2022/lib/base/classes/base-project-resolver.mjs +2 -11
- package/client/esm2022/lib/base/classes/base-project.mjs +83 -87
- package/client/esm2022/lib/base/classes/base-quick-fixes.mjs +44 -1
- package/client/esm2022/lib/base/classes/base-release-process.mjs +34 -36
- package/client/esm2022/lib/base/classes/{base-github-pages.mjs → base-static-pages.mjs} +6 -6
- package/client/esm2022/lib/base/classes/base-vscode.mjs +31 -1
- package/client/esm2022/lib/base/classes/index.mjs +5 -1
- package/client/esm2022/lib/base/commit-data.mjs +21 -4
- package/client/esm2022/lib/base/core-project.mjs +3 -3
- package/client/esm2022/lib/base/linked-project.mjs +4 -4
- package/client/esm2022/lib/base/tcp-udp-ports/tcp-udp-ports.context.mjs +2 -4
- package/client/esm2022/lib/base/translate.mjs +566 -0
- package/client/esm2022/lib/helpers/helpers-array-obj.mjs +5 -10
- package/client/esm2022/lib/helpers/helpers.mjs +12 -6
- package/client/esm2022/lib/index.mjs +2 -4
- package/client/esm2022/lib/models.mjs +173 -3
- package/client/esm2022/lib/utils.mjs +402 -41
- package/client/fesm2022/tnp-helpers.mjs +4616 -2904
- package/client/fesm2022/tnp-helpers.mjs.map +1 -1
- package/client/lib/base/classes/base-bower-json.d.ts +35 -0
- package/client/lib/base/classes/base-cli-worker.d.ts +2 -2
- package/client/lib/base/classes/base-debounce-compiler-for-project.d.ts +5 -5
- package/client/lib/base/classes/base-feature-for-project.d.ts +2 -1
- package/client/lib/base/classes/base-git.d.ts +42 -5
- package/client/lib/base/classes/base-json-file-reader.d.ts +72 -0
- package/client/lib/base/classes/base-library-build.d.ts +8 -11
- package/client/lib/base/classes/base-linked-projects.d.ts +1 -2
- package/client/lib/base/classes/base-node-modules.d.ts +56 -0
- package/client/lib/base/classes/base-npm-helpers.d.ts +29 -108
- package/client/lib/base/classes/base-package-json.d.ts +107 -0
- package/client/lib/base/classes/base-process-manager.d.ts +31 -0
- package/client/lib/base/classes/base-project-resolver.d.ts +2 -2
- package/client/lib/base/classes/base-project.d.ts +17 -18
- package/client/lib/base/classes/base-quick-fixes.d.ts +3 -1
- package/client/lib/base/classes/base-release-process.d.ts +15 -13
- package/{websql/lib/base/classes/base-github-pages.d.ts → client/lib/base/classes/base-static-pages.d.ts} +3 -3
- package/client/lib/base/classes/base-vscode.d.ts +4 -0
- package/client/lib/base/classes/index.d.ts +5 -1
- package/client/lib/base/commit-data.d.ts +14 -1
- package/client/lib/base/core-project.d.ts +1 -1
- package/client/lib/base/linked-project.d.ts +1 -1
- package/client/lib/base/tcp-udp-ports/ports.entity.d.ts +1 -1
- package/client/lib/base/translate.d.ts +228 -0
- package/client/lib/helpers/helpers-array-obj.d.ts +3 -0
- package/client/lib/helpers/helpers.d.ts +12 -8
- package/client/lib/index.d.ts +1 -3
- package/client/lib/models.d.ts +68 -8
- package/client/lib/utils.d.ts +72 -13
- package/index.js +15 -2
- package/index.js.map +1 -1
- package/lib/base/base-cli-worker-config.d.ts +27 -0
- package/lib/base/base-cli-worker-config.js +53 -0
- package/lib/base/base-cli-worker-config.js.map +1 -0
- package/lib/base/base-cli-worker-controller.d.ts +15 -0
- package/lib/base/base-cli-worker-controller.js +154 -0
- package/lib/base/base-cli-worker-controller.js.map +1 -0
- package/lib/base/base-cli-worker.d.ts +82 -0
- package/lib/base/base-cli-worker.js +654 -0
- package/lib/base/base-cli-worker.js.map +1 -0
- package/lib/base/base-command-line.backend.d.ts +174 -0
- package/lib/base/base-command-line.backend.js +2221 -0
- package/lib/base/base-command-line.backend.js.map +1 -0
- package/lib/base/base-compiler-for-project.d.ts +7 -0
- package/lib/base/base-compiler-for-project.js +62 -0
- package/lib/base/base-compiler-for-project.js.map +1 -0
- package/lib/base/base-db.d.ts +12 -0
- package/lib/base/base-db.js +74 -0
- package/lib/base/base-db.js.map +1 -0
- package/lib/base/base-debounce-compiler-for-project.d.ts +28 -0
- package/lib/base/base-debounce-compiler-for-project.js +82 -0
- package/lib/base/base-debounce-compiler-for-project.js.map +1 -0
- package/lib/base/base-detached-service.d.ts +6 -0
- package/lib/base/base-detached-service.js +16 -0
- package/lib/base/base-detached-service.js.map +1 -0
- package/lib/base/base-feature-for-project.d.ts +5 -0
- package/lib/base/base-feature-for-project.js +11 -0
- package/lib/base/base-feature-for-project.js.map +1 -0
- package/lib/base/base-git.d.ts +148 -0
- package/lib/base/base-git.js +1202 -0
- package/lib/base/base-git.js.map +1 -0
- package/{client/lib/base/classes → lib/base}/base-github-pages.d.ts +4 -5
- package/lib/base/base-github-pages.js +173 -0
- package/lib/base/base-github-pages.js.map +1 -0
- package/lib/base/base-ignore-hide.d.ts +14 -0
- package/lib/base/base-ignore-hide.js +55 -0
- package/lib/base/base-ignore-hide.js.map +1 -0
- package/lib/base/base-library-build.d.ts +65 -0
- package/lib/base/base-library-build.js +717 -0
- package/lib/base/base-library-build.js.map +1 -0
- package/lib/base/base-linked-projects.d.ts +24 -0
- package/lib/base/base-linked-projects.js +408 -0
- package/lib/base/base-linked-projects.js.map +1 -0
- package/lib/base/base-npm-helpers.d.ts +128 -0
- package/lib/base/base-npm-helpers.js +774 -0
- package/lib/base/base-npm-helpers.js.map +1 -0
- package/lib/base/base-project-resolver.d.ts +41 -0
- package/lib/base/base-project-resolver.js +308 -0
- package/lib/base/base-project-resolver.js.map +1 -0
- package/lib/base/base-project.d.ts +244 -0
- package/lib/base/base-project.js +1223 -0
- package/lib/base/base-project.js.map +1 -0
- package/lib/base/base-quick-fixes.d.ts +6 -0
- package/lib/base/base-quick-fixes.js +31 -0
- package/lib/base/base-quick-fixes.js.map +1 -0
- package/lib/base/base-release-process.d.ts +69 -0
- package/lib/base/base-release-process.js +913 -0
- package/lib/base/base-release-process.js.map +1 -0
- package/lib/base/base-start-config.backend.d.ts +36 -0
- package/lib/base/base-start-config.backend.js +167 -0
- package/lib/base/base-start-config.backend.js.map +1 -0
- package/lib/base/base-vscode.d.ts +12 -0
- package/lib/base/base-vscode.js +139 -0
- package/lib/base/base-vscode.js.map +1 -0
- package/lib/base/classes/base-bower-json.d.ts +34 -0
- package/lib/base/classes/base-bower-json.js +19 -0
- package/lib/base/classes/base-bower-json.js.map +1 -0
- package/lib/base/classes/base-cli-worker-config.js +35 -24
- package/lib/base/classes/base-cli-worker-config.js.map +1 -1
- package/lib/base/classes/base-cli-worker-controller.js +98 -128
- package/lib/base/classes/base-cli-worker-controller.js.map +1 -1
- package/lib/base/classes/base-cli-worker.d.ts +2 -2
- package/lib/base/classes/base-cli-worker.js +402 -606
- package/lib/base/classes/base-cli-worker.js.map +1 -1
- package/lib/base/classes/base-command-line-feature.backend.d.ts +5 -9
- package/lib/base/classes/base-command-line-feature.backend.js +73 -132
- package/lib/base/classes/base-command-line-feature.backend.js.map +1 -1
- package/lib/base/classes/base-command-line.backend.d.ts +175 -0
- package/lib/base/classes/base-command-line.backend.js +2235 -0
- package/lib/base/classes/base-command-line.backend.js.map +1 -0
- package/lib/base/classes/base-compiler-for-project.js +27 -32
- package/lib/base/classes/base-compiler-for-project.js.map +1 -1
- package/lib/base/classes/base-db.js +43 -60
- package/lib/base/classes/base-db.js.map +1 -1
- package/lib/base/classes/base-debounce-compiler-for-project.d.ts +5 -5
- package/lib/base/classes/base-debounce-compiler-for-project.js +44 -70
- package/lib/base/classes/base-debounce-compiler-for-project.js.map +1 -1
- package/lib/base/classes/base-detached-service.js.map +1 -1
- package/lib/base/classes/base-feature-for-project.d.ts +2 -1
- package/lib/base/classes/base-feature-for-project.js +7 -4
- package/lib/base/classes/base-feature-for-project.js.map +1 -1
- package/lib/base/classes/base-git.d.ts +40 -3
- package/lib/base/classes/base-git.js +885 -943
- package/lib/base/classes/base-git.js.map +1 -1
- package/lib/base/classes/base-github-pages.js.map +1 -1
- package/lib/base/classes/base-global-command-line.backend.d.ts +10 -2
- package/lib/base/classes/base-global-command-line.backend.js +1058 -2011
- package/lib/base/classes/base-global-command-line.backend.js.map +1 -1
- package/lib/base/classes/base-ignore-hide.d.ts +2 -2
- package/lib/base/classes/base-ignore-hide.js +24 -28
- package/lib/base/classes/base-ignore-hide.js.map +1 -1
- package/lib/base/classes/base-json-file-reader.d.ts +71 -0
- package/lib/base/classes/base-json-file-reader.js +141 -0
- package/lib/base/classes/base-json-file-reader.js.map +1 -0
- package/lib/base/classes/base-library-build.d.ts +8 -12
- package/lib/base/classes/base-library-build.js +433 -638
- package/lib/base/classes/base-library-build.js.map +1 -1
- package/lib/base/classes/base-linked-projects.d.ts +1 -3
- package/lib/base/classes/base-linked-projects.js +200 -314
- package/lib/base/classes/base-linked-projects.js.map +1 -1
- package/lib/base/classes/base-node-modules.d.ts +55 -0
- package/lib/base/classes/base-node-modules.js +415 -0
- package/lib/base/classes/base-node-modules.js.map +1 -0
- package/lib/base/classes/base-npm-helpers.d.ts +29 -97
- package/lib/base/classes/base-npm-helpers.js +178 -729
- package/lib/base/classes/base-npm-helpers.js.map +1 -1
- package/lib/base/classes/base-package-json.d.ts +106 -0
- package/lib/base/classes/base-package-json.js +381 -0
- package/lib/base/classes/base-package-json.js.map +1 -0
- package/lib/base/classes/base-process-manager.d.ts +30 -0
- package/lib/base/classes/base-process-manager.js +269 -0
- package/lib/base/classes/base-process-manager.js.map +1 -0
- package/lib/base/classes/base-project-resolver.d.ts +2 -3
- package/lib/base/classes/base-project-resolver.js +102 -119
- package/lib/base/classes/base-project-resolver.js.map +1 -1
- package/lib/base/classes/base-project.d.ts +20 -17
- package/lib/base/classes/base-project.js +553 -760
- package/lib/base/classes/base-project.js.map +1 -1
- package/lib/base/classes/base-quick-fixes.d.ts +3 -1
- package/lib/base/classes/base-quick-fixes.js +45 -17
- package/lib/base/classes/base-quick-fixes.js.map +1 -1
- package/lib/base/classes/base-release-process.d.ts +15 -13
- package/lib/base/classes/base-release-process.js +487 -835
- package/lib/base/classes/base-release-process.js.map +1 -1
- package/lib/base/classes/base-start-config.backend.js +116 -100
- package/lib/base/classes/base-start-config.backend.js.map +1 -1
- package/lib/base/classes/base-static-pages.d.ts +14 -0
- package/lib/base/classes/base-static-pages.js +105 -0
- package/lib/base/classes/base-static-pages.js.map +1 -0
- package/lib/base/classes/base-vscode.d.ts +4 -0
- package/lib/base/classes/base-vscode.js +446 -424
- package/lib/base/classes/base-vscode.js.map +1 -1
- package/lib/base/classes/index copy.d.ts +22 -0
- package/lib/base/classes/index copy.js +28 -0
- package/lib/base/classes/index copy.js.map +1 -0
- package/lib/base/classes/index.d.ts +4 -0
- package/lib/base/classes/index.js +36 -19
- package/lib/base/classes/index.js.map +1 -1
- package/lib/base/command-line-feature.backend.d.ts +51 -0
- package/lib/base/command-line-feature.backend.js +206 -0
- package/lib/base/command-line-feature.backend.js.map +1 -0
- package/lib/base/commit-data.d.ts +14 -1
- package/lib/base/commit-data.js +411 -464
- package/lib/base/commit-data.js.map +1 -1
- package/lib/base/config-database.js +33 -61
- package/lib/base/config-database.js.map +1 -1
- package/lib/base/core-project.d.ts +1 -1
- package/lib/base/core-project.js +110 -146
- package/lib/base/core-project.js.map +1 -1
- package/lib/base/gh-temp-code.d.ts +1 -0
- package/lib/base/gh-temp-code.js +62 -104
- package/lib/base/gh-temp-code.js.map +1 -1
- package/lib/base/index-rebuilder.backend.d.ts +1 -0
- package/lib/base/index-rebuilder.backend.js.map +1 -1
- package/lib/base/index.js +20 -7
- package/lib/base/index.js.map +1 -1
- package/lib/base/linked-project.d.ts +1 -1
- package/lib/base/linked-project.js +59 -38
- package/lib/base/linked-project.js.map +1 -1
- package/lib/base/ports-worker.d.ts +32 -0
- package/lib/base/ports-worker.js +244 -0
- package/lib/base/ports-worker.js.map +1 -0
- package/lib/base/project-database.js +12 -22
- package/lib/base/project-database.js.map +1 -1
- package/lib/base/tcp-udp-ports/index.js +17 -4
- package/lib/base/tcp-udp-ports/index.js.map +1 -1
- package/lib/base/tcp-udp-ports/not-assignable-port.entity.d.ts +1 -0
- package/lib/base/tcp-udp-ports/not-assignable-port.entity.js +2 -2
- package/lib/base/tcp-udp-ports/not-assignable-port.entity.js.map +1 -1
- package/lib/base/tcp-udp-ports/port.entity.d.ts +0 -0
- package/lib/base/tcp-udp-ports/port.entity.js +5 -0
- package/lib/base/tcp-udp-ports/port.entity.js.map +1 -0
- package/lib/base/tcp-udp-ports/ports.controller.js +195 -283
- package/lib/base/tcp-udp-ports/ports.controller.js.map +1 -1
- package/lib/base/tcp-udp-ports/ports.entity.d.ts +2 -2
- package/lib/base/tcp-udp-ports/ports.entity.js +74 -62
- package/lib/base/tcp-udp-ports/ports.entity.js.map +1 -1
- package/lib/base/tcp-udp-ports/tcp-udp-ports.context.js +11 -14
- package/lib/base/tcp-udp-ports/tcp-udp-ports.context.js.map +1 -1
- package/lib/base/tcp-udp-ports/tcp-upd-ports.worker.js +244 -427
- package/lib/base/tcp-udp-ports/tcp-upd-ports.worker.js.map +1 -1
- package/lib/base/tcp-upd-ports.worker.d.ts +13 -0
- package/lib/base/tcp-upd-ports.worker.js +99 -0
- package/lib/base/tcp-upd-ports.worker.js.map +1 -0
- package/lib/base/translate.d.ts +1 -1
- package/lib/base/translate.js +90 -119
- package/lib/base/translate.js.map +1 -1
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/helpers/for-backend/helpers-cli-tool.backend.js +109 -115
- package/lib/helpers/for-backend/helpers-cli-tool.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-console-gui.js +55 -102
- package/lib/helpers/for-backend/helpers-console-gui.js.map +1 -1
- package/lib/helpers/for-backend/helpers-dependencies.backend.js +28 -45
- package/lib/helpers/for-backend/helpers-dependencies.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-file-folders.backend.d.ts +2 -2
- package/lib/helpers/for-backend/helpers-file-folders.backend.js +277 -266
- package/lib/helpers/for-backend/helpers-file-folders.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-git.backend.d.ts +38 -3
- package/lib/helpers/for-backend/helpers-git.backend.js +806 -807
- package/lib/helpers/for-backend/helpers-git.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-network.backend.js +15 -18
- package/lib/helpers/for-backend/helpers-network.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-npm.backend.js +5 -8
- package/lib/helpers/for-backend/helpers-npm.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-path.backend.js +18 -26
- package/lib/helpers/for-backend/helpers-path.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-process.backend.d.ts +2 -2
- package/lib/helpers/for-backend/helpers-process.backend.js +285 -363
- package/lib/helpers/for-backend/helpers-process.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-system-terminal.backend.js +25 -42
- package/lib/helpers/for-backend/helpers-system-terminal.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-vscode.backend.js +9 -12
- package/lib/helpers/for-backend/helpers-vscode.backend.js.map +1 -1
- package/lib/helpers/for-backend/ts-code/index.js +0 -2
- package/lib/helpers/for-backend/ts-code/index.js.map +1 -1
- package/lib/helpers/for-backend/ts-code/ts-code-extractor.d.ts +26 -0
- package/lib/helpers/for-backend/ts-code/ts-code-extractor.js +62 -0
- package/lib/helpers/for-backend/ts-code/ts-code-extractor.js.map +1 -0
- package/lib/helpers/for-backend/ts-code/ts-code-modifier.backend.d.ts +19 -0
- package/lib/helpers/for-backend/ts-code/ts-code-modifier.backend.js +81 -0
- package/lib/helpers/for-backend/ts-code/ts-code-modifier.backend.js.map +1 -0
- package/lib/helpers/for-backend/ts-code/ts-import-export-extractor.js +2 -2
- package/lib/helpers/for-backend/ts-code/ts-import-export-extractor.js.map +1 -1
- package/lib/helpers/for-browser/angular.helper.js +2 -2
- package/lib/helpers/for-browser/angular.helper.js.map +1 -1
- package/lib/helpers/for-browser/helpers-browser.js +27 -40
- package/lib/helpers/for-browser/helpers-browser.js.map +1 -1
- package/lib/helpers/helpers-array-obj.d.ts +3 -0
- package/lib/helpers/helpers-array-obj.js +49 -61
- package/lib/helpers/helpers-array-obj.js.map +1 -1
- package/lib/helpers/helpers-json5.backend.js +44 -55
- package/lib/helpers/helpers-json5.backend.js.map +1 -1
- package/lib/helpers/helpers-numbers.js +7 -10
- package/lib/helpers/helpers-numbers.js.map +1 -1
- package/lib/helpers/helpers-strings-regexes.js +40 -47
- package/lib/helpers/helpers-strings-regexes.js.map +1 -1
- package/lib/helpers/helpers-strings.js +38 -41
- package/lib/helpers/helpers-strings.js.map +1 -1
- package/lib/helpers/helpers.d.ts +12 -8
- package/lib/helpers/helpers.js +313 -393
- package/lib/helpers/helpers.js.map +1 -1
- package/lib/index._auto-generated_.d.ts +1 -0
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.d.ts +3 -4
- package/lib/index.js +21 -10
- package/lib/index.js.map +1 -1
- package/lib/lowdb/adapters/Memory.js +14 -20
- package/lib/lowdb/adapters/Memory.js.map +1 -1
- package/lib/lowdb/adapters/browser/LocalStorage.js +5 -8
- package/lib/lowdb/adapters/browser/LocalStorage.js.map +1 -1
- package/lib/lowdb/adapters/browser/SessionStorage.js +5 -8
- package/lib/lowdb/adapters/browser/SessionStorage.js.map +1 -1
- package/lib/lowdb/adapters/browser/WebStorage.js +10 -9
- package/lib/lowdb/adapters/browser/WebStorage.js.map +1 -1
- package/lib/lowdb/adapters/node/DataFile.js +29 -38
- package/lib/lowdb/adapters/node/DataFile.js.map +1 -1
- package/lib/lowdb/adapters/node/JSONFile.js +13 -18
- package/lib/lowdb/adapters/node/JSONFile.js.map +1 -1
- package/lib/lowdb/adapters/node/TextFile.js +36 -44
- package/lib/lowdb/adapters/node/TextFile.js.map +1 -1
- package/lib/lowdb/adapters/node/steno.js +72 -122
- package/lib/lowdb/adapters/node/steno.js.map +1 -1
- package/lib/lowdb/browser.js +17 -4
- package/lib/lowdb/browser.js.map +1 -1
- package/lib/lowdb/core/Low.js +30 -60
- package/lib/lowdb/core/Low.js.map +1 -1
- package/lib/lowdb/examples/browser.js.map +1 -1
- package/lib/lowdb/examples/cli.d.ts +1 -0
- package/lib/lowdb/examples/cli.js.map +1 -1
- package/lib/lowdb/examples/in-memory.d.ts +1 -0
- package/lib/lowdb/examples/in-memory.js.map +1 -1
- package/lib/lowdb/examples/server.d.ts +1 -0
- package/lib/lowdb/examples/server.js.map +1 -1
- package/lib/lowdb/index.js +16 -3
- package/lib/lowdb/index.js.map +1 -1
- package/lib/lowdb/node.js +18 -5
- package/lib/lowdb/node.js.map +1 -1
- package/lib/lowdb/presets/browser.js +7 -7
- package/lib/lowdb/presets/browser.js.map +1 -1
- package/lib/lowdb/presets/node.js +12 -23
- package/lib/lowdb/presets/node.js.map +1 -1
- package/lib/models.d.ts +68 -8
- package/lib/models.js +197 -3
- package/lib/models.js.map +1 -1
- package/lib/old/base-component.d.ts +1 -0
- package/lib/old/base-component.js +2 -2
- package/lib/old/base-component.js.map +1 -1
- package/lib/old/base-formly-component.d.ts +1 -0
- package/lib/old/base-formly-component.js +2 -2
- package/lib/old/base-formly-component.js.map +1 -1
- package/lib/old/condition-wait.d.ts +1 -0
- package/lib/old/condition-wait.js.map +1 -1
- package/lib/old/dual-component-ctrl.d.ts +1 -0
- package/lib/old/dual-component-ctrl.js +2 -2
- package/lib/old/dual-component-ctrl.js.map +1 -1
- package/lib/old/execute-command.d.ts +11 -0
- package/lib/old/execute-command.js +564 -0
- package/lib/old/execute-command.js.map +1 -0
- package/lib/old/helpers.d.ts +62 -0
- package/lib/old/helpers.js +279 -0
- package/lib/old/helpers.js.map +1 -0
- package/lib/old/models.d.ts +80 -0
- package/lib/old/models.js +57 -0
- package/lib/old/models.js.map +1 -0
- package/lib/utils.d.ts +72 -13
- package/lib/utils.js +502 -179
- package/lib/utils.js.map +1 -1
- package/lib/validators/validators-firedev.js +5 -5
- package/lib/validators/validators-firedev.js.map +1 -1
- package/lib/validators/validators-git.js +2 -2
- package/lib/validators/validators-git.js.map +1 -1
- package/lib/validators/validators-network.js +1 -1
- package/lib/validators/validators-network.js.map +1 -1
- package/lib/validators/validators.js +2 -2
- package/lib/validators/validators.js.map +1 -1
- package/migrations/1736198527297_init.js +39 -58
- package/migrations/1736198527297_init.js.map +1 -1
- package/migrations/1736199486472_addingNotAssignablePorts.js +42 -93
- package/migrations/1736199486472_addingNotAssignablePorts.js.map +1 -1
- package/migrations/1736454437350_addFreePorts.js +48 -100
- package/migrations/1736454437350_addFreePorts.js.map +1 -1
- package/migrations/index.js +15 -2
- package/migrations/index.js.map +1 -1
- package/migrations/migrations_index._auto-generated_.js +3 -3
- package/migrations/migrations_index._auto-generated_.js.map +1 -1
- package/package.json +14 -61
- package/src.d.ts +1 -1
- package/taon.jsonc +34 -49
- package/tmp-environment.json +8 -389
- package/websql/README.md +24 -24
- package/websql/esm2022/lib/base/classes/base-bower-json.mjs +14 -0
- package/websql/esm2022/lib/base/classes/base-cli-worker-config.mjs +1 -4
- package/websql/esm2022/lib/base/classes/base-cli-worker-controller.mjs +1 -1
- package/websql/esm2022/lib/base/classes/base-cli-worker.mjs +14 -4
- package/websql/esm2022/lib/base/classes/base-debounce-compiler-for-project.mjs +5 -5
- package/websql/esm2022/lib/base/classes/base-feature-for-project.mjs +4 -1
- package/websql/esm2022/lib/base/classes/base-git.mjs +244 -4
- package/websql/esm2022/lib/base/classes/base-json-file-reader.mjs +114 -0
- package/websql/esm2022/lib/base/classes/base-library-build.mjs +35 -10
- package/websql/esm2022/lib/base/classes/base-linked-projects.mjs +8 -5
- package/websql/esm2022/lib/base/classes/base-node-modules.mjs +495 -0
- package/websql/esm2022/lib/base/classes/base-npm-helpers.mjs +32 -430
- package/websql/esm2022/lib/base/classes/base-package-json.mjs +340 -0
- package/websql/esm2022/lib/base/classes/base-process-manager.mjs +285 -0
- package/websql/esm2022/lib/base/classes/base-project-resolver.mjs +2 -10
- package/websql/esm2022/lib/base/classes/base-project.mjs +82 -87
- package/websql/esm2022/lib/base/classes/base-quick-fixes.mjs +44 -1
- package/websql/esm2022/lib/base/classes/base-release-process.mjs +34 -36
- package/websql/esm2022/lib/base/classes/{base-github-pages.mjs → base-static-pages.mjs} +6 -6
- package/websql/esm2022/lib/base/classes/base-vscode.mjs +31 -1
- package/websql/esm2022/lib/base/classes/index.mjs +5 -1
- package/websql/esm2022/lib/base/commit-data.mjs +21 -4
- package/websql/esm2022/lib/base/core-project.mjs +3 -3
- package/websql/esm2022/lib/base/linked-project.mjs +4 -4
- package/websql/esm2022/lib/base/tcp-udp-ports/tcp-udp-ports.context.mjs +2 -4
- package/websql/esm2022/lib/base/translate.mjs +566 -0
- package/websql/esm2022/lib/helpers/helpers-array-obj.mjs +5 -10
- package/websql/esm2022/lib/helpers/helpers.mjs +12 -6
- package/websql/esm2022/lib/index.mjs +2 -4
- package/websql/esm2022/lib/models.mjs +173 -3
- package/websql/esm2022/lib/utils.mjs +402 -41
- package/websql/fesm2022/tnp-helpers.mjs +4744 -3032
- package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
- package/websql/lib/base/classes/base-bower-json.d.ts +35 -0
- package/websql/lib/base/classes/base-cli-worker.d.ts +2 -2
- package/websql/lib/base/classes/base-debounce-compiler-for-project.d.ts +5 -5
- package/websql/lib/base/classes/base-feature-for-project.d.ts +2 -1
- package/websql/lib/base/classes/base-git.d.ts +42 -5
- package/websql/lib/base/classes/base-json-file-reader.d.ts +72 -0
- package/websql/lib/base/classes/base-library-build.d.ts +8 -11
- package/websql/lib/base/classes/base-linked-projects.d.ts +1 -2
- package/websql/lib/base/classes/base-node-modules.d.ts +56 -0
- package/websql/lib/base/classes/base-npm-helpers.d.ts +29 -108
- package/websql/lib/base/classes/base-package-json.d.ts +107 -0
- package/websql/lib/base/classes/base-process-manager.d.ts +31 -0
- package/websql/lib/base/classes/base-project-resolver.d.ts +2 -2
- package/websql/lib/base/classes/base-project.d.ts +17 -18
- package/websql/lib/base/classes/base-quick-fixes.d.ts +3 -1
- package/websql/lib/base/classes/base-release-process.d.ts +15 -13
- package/websql/lib/base/classes/base-static-pages.d.ts +15 -0
- package/websql/lib/base/classes/base-vscode.d.ts +4 -0
- package/websql/lib/base/classes/index.d.ts +5 -1
- package/websql/lib/base/commit-data.d.ts +14 -1
- package/websql/lib/base/core-project.d.ts +1 -1
- package/websql/lib/base/linked-project.d.ts +1 -1
- package/websql/lib/base/tcp-udp-ports/ports.entity.d.ts +1 -1
- package/websql/lib/base/translate.d.ts +228 -0
- package/websql/lib/helpers/helpers-array-obj.d.ts +3 -0
- package/websql/lib/helpers/helpers.d.ts +12 -8
- package/websql/lib/index.d.ts +1 -3
- package/websql/lib/models.d.ts +68 -8
- package/websql/lib/utils.d.ts +72 -13
- package/browser/package.json +0 -25
- package/websql/package.json +0 -25
package/lib/utils.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UtilsQuickFixes = exports.UtilsMd = exports.UtilsHttp = exports.UtilsTypescript = exports.UtilsNpm = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
4
|
//#region imports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var typescript_1 = require("typescript");
|
|
10
|
-
//#endregion
|
|
11
|
-
var tnp_core_2 = require("tnp-core");
|
|
5
|
+
const tnp_core_1 = require("tnp-core");
|
|
6
|
+
const tnp_core_2 = require("tnp-core");
|
|
7
|
+
const typescript_1 = require("typescript");
|
|
12
8
|
//#endregion
|
|
13
9
|
//#region utils npm
|
|
14
10
|
var UtilsNpm;
|
|
15
11
|
(function (UtilsNpm) {
|
|
16
12
|
//#region is special version
|
|
17
|
-
UtilsNpm.isSpecialVersion =
|
|
13
|
+
UtilsNpm.isSpecialVersion = (version) => {
|
|
18
14
|
return tnp_core_2.CoreModels.NpmSpecialVersions.includes(version);
|
|
19
15
|
};
|
|
20
16
|
//#endregion
|
|
21
17
|
//#region clear version
|
|
22
|
-
UtilsNpm.clearVersion =
|
|
23
|
-
|
|
18
|
+
UtilsNpm.clearVersion = (version, options) => {
|
|
19
|
+
const { removePrefixes, removeSuffix } = options || {};
|
|
24
20
|
if (!version || UtilsNpm.isSpecialVersion(version)) {
|
|
25
21
|
return version;
|
|
26
22
|
}
|
|
@@ -30,23 +26,23 @@ var UtilsNpm;
|
|
|
30
26
|
if (removePrefixes) {
|
|
31
27
|
version = version.replace('^', '').replace('~', '');
|
|
32
28
|
}
|
|
33
|
-
|
|
29
|
+
let [major, minor, patch, alphaOrBetaOrRc] = version.split('.');
|
|
34
30
|
if (removeSuffix) {
|
|
35
31
|
alphaOrBetaOrRc = '';
|
|
36
32
|
}
|
|
37
|
-
return UtilsNpm.fixMajorVerNumber(
|
|
33
|
+
return UtilsNpm.fixMajorVerNumber(`${major}.${minor}.${patch}${alphaOrBetaOrRc ? '.' + alphaOrBetaOrRc : ''}`);
|
|
38
34
|
};
|
|
39
35
|
//#endregion
|
|
40
36
|
//#region fix major version number
|
|
41
|
-
UtilsNpm.fixMajorVerNumber =
|
|
37
|
+
UtilsNpm.fixMajorVerNumber = (version) => {
|
|
42
38
|
if (!version || UtilsNpm.isSpecialVersion(version)) {
|
|
43
39
|
return version;
|
|
44
40
|
}
|
|
45
41
|
version = (version || '')
|
|
46
42
|
.trim()
|
|
47
43
|
.replace(new RegExp(tnp_core_2.Utils.escapeStringForRegEx('undefined'), 'g'), '0');
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
const splited = version.split('.');
|
|
45
|
+
let [major, minor, patch, alphaOrBetaOrRc] = splited;
|
|
50
46
|
if (splited.length === 1) {
|
|
51
47
|
minor = '0';
|
|
52
48
|
patch = '0';
|
|
@@ -54,7 +50,7 @@ var UtilsNpm;
|
|
|
54
50
|
else if (splited.length === 2) {
|
|
55
51
|
patch = '0';
|
|
56
52
|
}
|
|
57
|
-
return
|
|
53
|
+
return `${major}.${minor}.${patch}${alphaOrBetaOrRc ? '.' + alphaOrBetaOrRc : ''}`;
|
|
58
54
|
};
|
|
59
55
|
//#endregion
|
|
60
56
|
})(UtilsNpm || (exports.UtilsNpm = UtilsNpm = {}));
|
|
@@ -70,18 +66,18 @@ var UtilsTypescript;
|
|
|
70
66
|
* @param regionName - The name of the region to remove.
|
|
71
67
|
* @returns Modified TypeScript code without the specified regions.
|
|
72
68
|
*/
|
|
73
|
-
UtilsTypescript.removeRegionByName =
|
|
69
|
+
UtilsTypescript.removeRegionByName = (sourceCode, regionName) => {
|
|
74
70
|
//#region @backendFunc
|
|
75
71
|
// Create a source file using TypeScript's compiler API
|
|
76
|
-
|
|
72
|
+
const sourceFile = (0, typescript_1.createSourceFile)('temp.ts', sourceCode, typescript_1.ScriptTarget.Latest, true, typescript_1.ScriptKind.TS);
|
|
77
73
|
// Prepare a printer to convert the modified AST back to code
|
|
78
|
-
|
|
74
|
+
const printer = (0, typescript_1.createPrinter)();
|
|
79
75
|
// Traverse the AST and remove specified //#region blocks
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
const transformer = (context) => {
|
|
77
|
+
const visit = (node) => {
|
|
82
78
|
// @ts-ignore
|
|
83
79
|
if ((0, typescript_1.isSourceFile)(node)) {
|
|
84
|
-
|
|
80
|
+
const statements = removeRegions(node.statements, regionName);
|
|
85
81
|
// @ts-ignore
|
|
86
82
|
return typescript_1.factory.updateSourceFile(node, statements);
|
|
87
83
|
}
|
|
@@ -92,11 +88,11 @@ var UtilsTypescript;
|
|
|
92
88
|
};
|
|
93
89
|
// Apply the transformation
|
|
94
90
|
// @ts-ignore
|
|
95
|
-
|
|
91
|
+
const result = (0, typescript_1.transform)(sourceFile, [transformer]);
|
|
96
92
|
// Get the modified source file
|
|
97
|
-
|
|
93
|
+
const transformedSourceFile = result.transformed[0];
|
|
98
94
|
// Print the transformed source file back to a string
|
|
99
|
-
|
|
95
|
+
const modifiedCode = printer.printFile(transformedSourceFile);
|
|
100
96
|
result.dispose();
|
|
101
97
|
return modifiedCode;
|
|
102
98
|
//#endregion
|
|
@@ -108,71 +104,50 @@ var UtilsTypescript;
|
|
|
108
104
|
* @param regionName - The name of the region to remove.
|
|
109
105
|
* @returns Modified list of statements without the specified regions.
|
|
110
106
|
*/
|
|
111
|
-
|
|
112
|
-
var e_1, _a, e_2, _b;
|
|
107
|
+
const removeRegions = (statements, regionName) => {
|
|
113
108
|
//#region @backendFunc
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
138
|
-
// Check if this region matches the target
|
|
139
|
-
if (name_1 === regionName) {
|
|
140
|
-
stack[stack.length - 1].insideTargetRegion = true;
|
|
141
|
-
}
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
// Detect end of a region
|
|
145
|
-
if (comment.startsWith('//#endregion')) {
|
|
146
|
-
if (stack.length > 0 &&
|
|
147
|
-
stack[stack.length - 1].level === currentLevel) {
|
|
148
|
-
stack.pop();
|
|
149
|
-
}
|
|
150
|
-
currentLevel--;
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
109
|
+
const result = [];
|
|
110
|
+
const stack = [];
|
|
111
|
+
let currentLevel = 0;
|
|
112
|
+
for (const statement of statements) {
|
|
113
|
+
const commentRanges = (0, typescript_1.getLeadingCommentRanges)(statement.getFullText(), 0) || [];
|
|
114
|
+
const commentText = statement.getFullText();
|
|
115
|
+
for (const range of commentRanges) {
|
|
116
|
+
const comment = commentText.slice(range.pos, range.end).trim();
|
|
117
|
+
// Detect start of a region
|
|
118
|
+
const regionMatch = comment.match(/^\/\/#region (.*)/);
|
|
119
|
+
if (regionMatch) {
|
|
120
|
+
currentLevel++;
|
|
121
|
+
const name = regionMatch[1].trim();
|
|
122
|
+
// Push the current state of the stack
|
|
123
|
+
stack.push({
|
|
124
|
+
insideTargetRegion: stack.length > 0
|
|
125
|
+
? stack[stack.length - 1].insideTargetRegion
|
|
126
|
+
: false,
|
|
127
|
+
level: currentLevel,
|
|
128
|
+
});
|
|
129
|
+
// Check if this region matches the target
|
|
130
|
+
if (name === regionName) {
|
|
131
|
+
stack[stack.length - 1].insideTargetRegion = true;
|
|
153
132
|
}
|
|
133
|
+
continue;
|
|
154
134
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
135
|
+
// Detect end of a region
|
|
136
|
+
if (comment.startsWith('//#endregion')) {
|
|
137
|
+
if (stack.length > 0 &&
|
|
138
|
+
stack[stack.length - 1].level === currentLevel) {
|
|
139
|
+
stack.pop();
|
|
159
140
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// Check the top of the stack to see if we're inside the target region
|
|
163
|
-
var insideTargetRegion = stack.length > 0 ? stack[stack.length - 1].insideTargetRegion : false;
|
|
164
|
-
// Add statements that are not inside the target region
|
|
165
|
-
if (!insideTargetRegion) {
|
|
166
|
-
result.push(statement);
|
|
141
|
+
currentLevel--;
|
|
142
|
+
continue;
|
|
167
143
|
}
|
|
168
144
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
145
|
+
// Check the top of the stack to see if we're inside the target region
|
|
146
|
+
const insideTargetRegion = stack.length > 0 ? stack[stack.length - 1].insideTargetRegion : false;
|
|
147
|
+
// Add statements that are not inside the target region
|
|
148
|
+
if (!insideTargetRegion) {
|
|
149
|
+
result.push(statement);
|
|
174
150
|
}
|
|
175
|
-
finally { if (e_1) throw e_1.error; }
|
|
176
151
|
}
|
|
177
152
|
return result;
|
|
178
153
|
//#endregion
|
|
@@ -180,29 +155,38 @@ var UtilsTypescript;
|
|
|
180
155
|
//#endregion
|
|
181
156
|
//#region extract exports from a TypeScript file
|
|
182
157
|
//#region helper function to check if a node is exported
|
|
183
|
-
|
|
184
|
-
var _a;
|
|
158
|
+
const isExported = (node) => {
|
|
185
159
|
//#region @backendFunc
|
|
186
160
|
return (((0, typescript_1.getCombinedModifierFlags)(node) & typescript_1.ModifierFlags.Export) !==
|
|
187
|
-
0 ||
|
|
161
|
+
0 || node.parent?.kind === typescript_1.SyntaxKind.SourceFile // For top-level exports
|
|
188
162
|
);
|
|
189
163
|
//#endregion
|
|
190
164
|
};
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region exports from file
|
|
193
165
|
/**
|
|
194
166
|
* Function to extract exports from a TypeScript file
|
|
195
167
|
*/
|
|
196
|
-
UtilsTypescript.exportsFromFile =
|
|
168
|
+
UtilsTypescript.exportsFromFile = (filePath) => {
|
|
169
|
+
//#region @backendFunc
|
|
170
|
+
if (!filePath.endsWith('.ts')) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
const file = tnp_core_1.Helpers.readFile(filePath);
|
|
174
|
+
return UtilsTypescript.exportsFromContent(file);
|
|
175
|
+
//#endregion
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Function to extract exports from a TypeScript file
|
|
179
|
+
*/
|
|
180
|
+
UtilsTypescript.exportsFromContent = (fileContent) => {
|
|
197
181
|
//#region @backendFunc
|
|
198
182
|
// Read the content of the file
|
|
199
|
-
|
|
183
|
+
const sourceCode = fileContent;
|
|
200
184
|
// Create a SourceFile object using the TypeScript API
|
|
201
|
-
|
|
185
|
+
const sourceFile = (0, typescript_1.createSourceFile)('temp.ts', sourceCode, typescript_1.ScriptTarget.Latest, true);
|
|
202
186
|
// Array to hold the exports found
|
|
203
|
-
|
|
187
|
+
const exports = [];
|
|
204
188
|
//#region function to recursively check each node in the AST
|
|
205
|
-
|
|
189
|
+
const checkNode = (node) => {
|
|
206
190
|
//#region @backendFunc
|
|
207
191
|
// Determine the type and name of export based on node type
|
|
208
192
|
if ((0, typescript_1.isClassDeclaration)(node) && node.name && isExported(node)) {
|
|
@@ -212,7 +196,7 @@ var UtilsTypescript;
|
|
|
212
196
|
exports.push({ type: 'function', name: node.name.text });
|
|
213
197
|
}
|
|
214
198
|
else if ((0, typescript_1.isVariableStatement)(node) && isExported(node)) {
|
|
215
|
-
node.declarationList.declarations.forEach(
|
|
199
|
+
node.declarationList.declarations.forEach(declaration => {
|
|
216
200
|
if ((0, typescript_1.isIdentifier)(declaration.name)) {
|
|
217
201
|
exports.push({
|
|
218
202
|
type: node.declarationList.flags & typescript_1.NodeFlags.Const
|
|
@@ -253,15 +237,14 @@ var UtilsTypescript;
|
|
|
253
237
|
//#endregion
|
|
254
238
|
//#endregion
|
|
255
239
|
//#region extract class names from ts file or source code
|
|
256
|
-
UtilsTypescript.extractDefaultClassNameFromString =
|
|
240
|
+
UtilsTypescript.extractDefaultClassNameFromString = (sourceCode) => {
|
|
257
241
|
//#region @backendFunc
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
var _a, _b;
|
|
242
|
+
const sourceFile = (0, typescript_1.createSourceFile)('temp.ts', sourceCode, typescript_1.ScriptTarget.Latest, true, typescript_1.ScriptKind.TS);
|
|
243
|
+
let defaultClassName = '';
|
|
244
|
+
const checkNode = (node) => {
|
|
262
245
|
if ((0, typescript_1.isClassDeclaration)(node) &&
|
|
263
|
-
|
|
264
|
-
defaultClassName =
|
|
246
|
+
node.modifiers?.find(m => m.kind === typescript_1.SyntaxKind.DefaultKeyword)) {
|
|
247
|
+
defaultClassName = node.name?.text || '';
|
|
265
248
|
}
|
|
266
249
|
(0, typescript_1.forEachChild)(node, checkNode);
|
|
267
250
|
};
|
|
@@ -269,14 +252,13 @@ var UtilsTypescript;
|
|
|
269
252
|
return defaultClassName;
|
|
270
253
|
//#endregion
|
|
271
254
|
};
|
|
272
|
-
UtilsTypescript.extractClassNameFromString =
|
|
255
|
+
UtilsTypescript.extractClassNameFromString = (sourceCode) => {
|
|
273
256
|
//#region @backendFunc
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
var _a;
|
|
257
|
+
const sourceFile = (0, typescript_1.createSourceFile)('temp.ts', sourceCode, typescript_1.ScriptTarget.Latest, true, typescript_1.ScriptKind.TS);
|
|
258
|
+
const classNames = [];
|
|
259
|
+
const checkNode = (node) => {
|
|
278
260
|
if ((0, typescript_1.isClassDeclaration)(node)) {
|
|
279
|
-
classNames.push(
|
|
261
|
+
classNames.push(node.name?.text || '');
|
|
280
262
|
}
|
|
281
263
|
(0, typescript_1.forEachChild)(node, checkNode);
|
|
282
264
|
};
|
|
@@ -284,68 +266,71 @@ var UtilsTypescript;
|
|
|
284
266
|
return classNames;
|
|
285
267
|
//#endregion
|
|
286
268
|
};
|
|
287
|
-
UtilsTypescript.extractClassNamesFromFile =
|
|
269
|
+
UtilsTypescript.extractClassNamesFromFile = (absoluteFilePath) => {
|
|
288
270
|
//#region @backendFunc
|
|
289
|
-
|
|
271
|
+
if (!absoluteFilePath.endsWith('.ts')) {
|
|
272
|
+
return [];
|
|
273
|
+
}
|
|
274
|
+
const sourceCode = tnp_core_1.Helpers.readFile(absoluteFilePath);
|
|
290
275
|
return UtilsTypescript.extractClassNameFromString(sourceCode);
|
|
291
276
|
//#endregion
|
|
292
277
|
};
|
|
293
|
-
UtilsTypescript.extractDefaultClassNameFromFile =
|
|
278
|
+
UtilsTypescript.extractDefaultClassNameFromFile = (absoluteFilePath) => {
|
|
294
279
|
//#region @backendFunc
|
|
295
|
-
|
|
280
|
+
const sourceCode = tnp_core_1.Helpers.readFile(absoluteFilePath);
|
|
296
281
|
return UtilsTypescript.extractDefaultClassNameFromString(sourceCode);
|
|
297
282
|
//#endregion
|
|
298
283
|
};
|
|
299
284
|
//#endregion
|
|
300
285
|
//#region format file(s) with prettier
|
|
301
|
-
UtilsTypescript.formatFile =
|
|
286
|
+
UtilsTypescript.formatFile = (absPathToFile) => {
|
|
302
287
|
//#region @backendFunc
|
|
303
288
|
if (tnp_core_1.Helpers.exists(absPathToFile)) {
|
|
304
|
-
|
|
305
|
-
tnp_core_1.Helpers.logInfo(
|
|
289
|
+
const { execSync } = require('child_process');
|
|
290
|
+
tnp_core_1.Helpers.logInfo(`Formatting file: ${absPathToFile}`);
|
|
306
291
|
try {
|
|
307
|
-
execSync(
|
|
292
|
+
execSync(`prettier --write ${tnp_core_1.path.basename(absPathToFile)}`, {
|
|
308
293
|
cwd: tnp_core_1.path.dirname(absPathToFile),
|
|
309
294
|
});
|
|
310
295
|
}
|
|
311
296
|
catch (error) {
|
|
312
|
-
console.warn(
|
|
297
|
+
console.warn(`Not able to format file: ${absPathToFile}`);
|
|
313
298
|
}
|
|
299
|
+
tnp_core_1.Helpers.taskDone(`Formatting file done.`);
|
|
314
300
|
}
|
|
315
301
|
//#endregion
|
|
316
302
|
};
|
|
317
|
-
UtilsTypescript.formatAllFilesInsideFolder =
|
|
303
|
+
UtilsTypescript.formatAllFilesInsideFolder = (absPathToFolder) => {
|
|
318
304
|
//#region @backendFunc
|
|
319
305
|
if (tnp_core_1.Helpers.exists(absPathToFolder)) {
|
|
320
|
-
|
|
306
|
+
const { execSync } = require('child_process');
|
|
321
307
|
try {
|
|
322
|
-
execSync(
|
|
308
|
+
execSync(`prettier --write .`, { cwd: absPathToFolder });
|
|
323
309
|
}
|
|
324
310
|
catch (error) {
|
|
325
|
-
console.warn(
|
|
311
|
+
console.warn(`Not able to files in: ${absPathToFolder}`);
|
|
326
312
|
}
|
|
327
313
|
}
|
|
328
314
|
//#endregion
|
|
329
315
|
};
|
|
330
316
|
//#endregion
|
|
331
317
|
//#region extract Taon contexts from file
|
|
332
|
-
UtilsTypescript.getTaonContextFromContent =
|
|
318
|
+
UtilsTypescript.getTaonContextFromContent = (fileContent) => {
|
|
333
319
|
//#region @backendFunc
|
|
334
|
-
|
|
335
|
-
|
|
320
|
+
const sourceFile = (0, typescript_1.createSourceFile)('tempFile.ts', fileContent, typescript_1.ScriptTarget.Latest, true);
|
|
321
|
+
const contextNames = [];
|
|
336
322
|
// Recursive function to walk through the AST
|
|
337
|
-
|
|
338
|
-
var _a, _b;
|
|
323
|
+
const visitNode = (node) => {
|
|
339
324
|
try {
|
|
340
325
|
if ((0, typescript_1.isVariableDeclaration)(node) &&
|
|
341
326
|
node.initializer &&
|
|
342
327
|
(0, typescript_1.isCallExpression)(node.initializer)) {
|
|
343
|
-
|
|
344
|
-
|
|
328
|
+
let functionName = '';
|
|
329
|
+
let objectName = '';
|
|
345
330
|
if ((0, typescript_1.isPropertyAccessExpression)(node.initializer.expression)) {
|
|
346
|
-
functionName =
|
|
331
|
+
functionName = node.initializer.expression.name?.text || '';
|
|
347
332
|
objectName =
|
|
348
|
-
|
|
333
|
+
node.initializer.expression.expression?.getText() || '';
|
|
349
334
|
}
|
|
350
335
|
else if ((0, typescript_1.isIdentifier)(node.initializer.expression)) {
|
|
351
336
|
functionName = node.initializer.expression.text;
|
|
@@ -372,41 +357,372 @@ var UtilsTypescript;
|
|
|
372
357
|
return contextNames;
|
|
373
358
|
//#endregion
|
|
374
359
|
};
|
|
375
|
-
UtilsTypescript.getTaonContextsNamesFromFile =
|
|
360
|
+
UtilsTypescript.getTaonContextsNamesFromFile = (tsAbsFilePath) => {
|
|
376
361
|
//#region @backendFunc
|
|
377
362
|
return UtilsTypescript.getTaonContextFromContent(tnp_core_1.Helpers.readFile(tsAbsFilePath));
|
|
378
363
|
//#endregion
|
|
379
364
|
};
|
|
380
365
|
//#endregion
|
|
366
|
+
//#region extract selectors from Angular components class files
|
|
367
|
+
UtilsTypescript.extractAngularComponentSelectors = (fileAbsPath) => {
|
|
368
|
+
//#region @backendFunc
|
|
369
|
+
const sourceFile = (0, typescript_1.createSourceFile)(fileAbsPath, tnp_core_1.Helpers.readFile(fileAbsPath), typescript_1.ScriptTarget.Latest, true);
|
|
370
|
+
const selectors = [];
|
|
371
|
+
const visit = (node) => {
|
|
372
|
+
if ((0, typescript_1.isClassDeclaration)(node) && node.name) {
|
|
373
|
+
const decorators = (0, typescript_1.canHaveDecorators)(node)
|
|
374
|
+
? (0, typescript_1.getDecorators)(node)
|
|
375
|
+
: undefined;
|
|
376
|
+
if (decorators) {
|
|
377
|
+
for (const decorator of decorators) {
|
|
378
|
+
if ((0, typescript_1.isCallExpression)(decorator.expression) &&
|
|
379
|
+
(0, typescript_1.isIdentifier)(decorator.expression.expression) &&
|
|
380
|
+
decorator.expression.expression.text === 'Component') {
|
|
381
|
+
const args = decorator.expression.arguments;
|
|
382
|
+
if (args.length > 0 && (0, typescript_1.isObjectLiteralExpression)(args[0])) {
|
|
383
|
+
for (const property of args[0].properties) {
|
|
384
|
+
if ((0, typescript_1.isPropertyAssignment)(property) &&
|
|
385
|
+
(0, typescript_1.isIdentifier)(property.name) &&
|
|
386
|
+
property.name.text === 'selector' &&
|
|
387
|
+
(0, typescript_1.isStringLiteral)(property.initializer)) {
|
|
388
|
+
selectors.push({
|
|
389
|
+
className: node.name.text,
|
|
390
|
+
selector: property.initializer.text,
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
(0, typescript_1.forEachChild)(node, visit);
|
|
400
|
+
};
|
|
401
|
+
visit(sourceFile);
|
|
402
|
+
return selectors;
|
|
403
|
+
//#endregion
|
|
404
|
+
};
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region wrap one line with comment
|
|
407
|
+
UtilsTypescript.wrapWithComment = (oneLineComment, absDestFilePath) => {
|
|
408
|
+
//#region @backendFunc
|
|
409
|
+
const ext = tnp_core_1.path.extname(absDestFilePath).toLowerCase();
|
|
410
|
+
let commentSyntax;
|
|
411
|
+
switch (ext) {
|
|
412
|
+
case '.ts':
|
|
413
|
+
case '.js':
|
|
414
|
+
case '.jsonc':
|
|
415
|
+
case '.sh':
|
|
416
|
+
commentSyntax = `// ${oneLineComment}`;
|
|
417
|
+
break;
|
|
418
|
+
case '.html':
|
|
419
|
+
commentSyntax = `<!-- ${oneLineComment} -->`;
|
|
420
|
+
break;
|
|
421
|
+
case '.css':
|
|
422
|
+
case '.scss':
|
|
423
|
+
case '.sass':
|
|
424
|
+
commentSyntax = `/* ${oneLineComment} */`;
|
|
425
|
+
break;
|
|
426
|
+
default:
|
|
427
|
+
console.warn(`Unknown file extension: ${ext}`);
|
|
428
|
+
commentSyntax = oneLineComment;
|
|
429
|
+
}
|
|
430
|
+
return commentSyntax;
|
|
431
|
+
//#endregion
|
|
432
|
+
};
|
|
433
|
+
//#endregion
|
|
434
|
+
//#region ser or add exported variable with AST
|
|
435
|
+
// Helper to check if a node has 'export' in its modifiers
|
|
436
|
+
// const hasExportModifier = (
|
|
437
|
+
// modifiers: ts.NodeArray<ts.Modifier> | undefined,
|
|
438
|
+
// ) => {
|
|
439
|
+
// return (
|
|
440
|
+
// !!modifiers && modifiers.some(m => m.kind === SyntaxKind.ExportKeyword)
|
|
441
|
+
// );
|
|
442
|
+
// };
|
|
443
|
+
/**
|
|
444
|
+
* Attempts to set or add an exported const with given name and value.
|
|
445
|
+
*/
|
|
446
|
+
UtilsTypescript.setValueToVariableInTsFile = (tsAbsFilePath, variableName, valueOfVariable, addIfNotExists = true) => {
|
|
447
|
+
//#region @backendFunc
|
|
448
|
+
const sourceText = tnp_core_1.Helpers.readFile(tsAbsFilePath);
|
|
449
|
+
const sourceFile = (0, typescript_1.createSourceFile)(tsAbsFilePath, sourceText, typescript_1.ScriptTarget.Latest,
|
|
450
|
+
/*setParentNodes */ true);
|
|
451
|
+
// We'll build an AST transformer that modifies or inserts our variable declaration
|
|
452
|
+
const transformer = (context) => {
|
|
453
|
+
const { factory } = context;
|
|
454
|
+
return (rootNode) => {
|
|
455
|
+
let variableFound = false;
|
|
456
|
+
const visit = (node) => {
|
|
457
|
+
// Check for "export const <variableName> = ...;"
|
|
458
|
+
if ((0, typescript_1.isVariableStatement)(node)
|
|
459
|
+
// && hasExportModifier(node.modifiers as any)
|
|
460
|
+
) {
|
|
461
|
+
const declList = node.declarationList;
|
|
462
|
+
const newDeclarations = declList.declarations.map(decl => {
|
|
463
|
+
if ((0, typescript_1.isIdentifier)(decl.name) && decl.name.text === variableName) {
|
|
464
|
+
variableFound = true;
|
|
465
|
+
// Create a new initializer. If valueOfVariable is a string,
|
|
466
|
+
// we wrap it with quotes; otherwise, create a numeric or object literal.
|
|
467
|
+
let initializer;
|
|
468
|
+
if (typeof valueOfVariable === 'string') {
|
|
469
|
+
initializer = factory.createStringLiteral(valueOfVariable);
|
|
470
|
+
}
|
|
471
|
+
else if (typeof valueOfVariable === 'number') {
|
|
472
|
+
initializer = factory.createNumericLiteral(valueOfVariable);
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
// Fallback: wrap JSON string => parse with TS
|
|
476
|
+
// Or you can create a more sophisticated approach for arrays/objects
|
|
477
|
+
initializer = factory.createIdentifier(JSON.stringify(valueOfVariable));
|
|
478
|
+
}
|
|
479
|
+
// Return a new variable declaration with the updated initializer
|
|
480
|
+
return factory.updateVariableDeclaration(decl, decl.name, decl.exclamationToken, decl.type, initializer);
|
|
481
|
+
}
|
|
482
|
+
return decl;
|
|
483
|
+
});
|
|
484
|
+
// Return a new VariableStatement if we changed anything
|
|
485
|
+
return factory.updateVariableStatement(node, node.modifiers, factory.updateVariableDeclarationList(declList, newDeclarations));
|
|
486
|
+
}
|
|
487
|
+
return (0, typescript_1.visitEachChild)(node, visit, context);
|
|
488
|
+
};
|
|
489
|
+
let updatedRoot = (0, typescript_1.visitNode)(rootNode, visit);
|
|
490
|
+
// If variable not found and addIfNotExists === true, add a new export statement
|
|
491
|
+
if (!variableFound && addIfNotExists) {
|
|
492
|
+
// Create something like: export const <variableName> = <valueOfVariable>;
|
|
493
|
+
let initializer;
|
|
494
|
+
if (typeof valueOfVariable === 'string') {
|
|
495
|
+
initializer = factory.createStringLiteral(valueOfVariable);
|
|
496
|
+
}
|
|
497
|
+
else if (typeof valueOfVariable === 'number') {
|
|
498
|
+
initializer = factory.createNumericLiteral(valueOfVariable);
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
initializer = factory.createIdentifier(JSON.stringify(valueOfVariable));
|
|
502
|
+
}
|
|
503
|
+
const newVarStatement = factory.createVariableStatement([factory.createModifier(typescript_1.SyntaxKind.ExportKeyword)], factory.createVariableDeclarationList([
|
|
504
|
+
factory.createVariableDeclaration(factory.createIdentifier(variableName),
|
|
505
|
+
/* exclamationToken */ undefined,
|
|
506
|
+
/* type */ undefined, initializer),
|
|
507
|
+
], typescript_1.NodeFlags.Const));
|
|
508
|
+
// Append it to the end of the file
|
|
509
|
+
const newStatements = [...updatedRoot.statements, newVarStatement];
|
|
510
|
+
updatedRoot = factory.updateSourceFile(updatedRoot, newStatements);
|
|
511
|
+
}
|
|
512
|
+
return updatedRoot;
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
// Apply the transformer
|
|
516
|
+
const result = (0, typescript_1.transform)(sourceFile, [transformer]);
|
|
517
|
+
const transformedSourceFile = result.transformed[0];
|
|
518
|
+
// Print the new AST back to text
|
|
519
|
+
const printer = (0, typescript_1.createPrinter)();
|
|
520
|
+
const newContent = printer.printFile(transformedSourceFile);
|
|
521
|
+
// Overwrite the file
|
|
522
|
+
tnp_core_1.Helpers.writeFile(tsAbsFilePath, newContent);
|
|
523
|
+
result.dispose();
|
|
524
|
+
//#endregion
|
|
525
|
+
};
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region recognize imports from file
|
|
528
|
+
//#region helpers / ts import export class
|
|
529
|
+
class TsImportExport {
|
|
530
|
+
type;
|
|
531
|
+
/**
|
|
532
|
+
* ORIGNAL
|
|
533
|
+
* Name of the file that is being imported/exported
|
|
534
|
+
* with parenthesis included
|
|
535
|
+
*/
|
|
536
|
+
embeddedPathToFile;
|
|
537
|
+
/**
|
|
538
|
+
* same as cleanEmbeddedPathToFile but without quotes (parenthesis)
|
|
539
|
+
*/
|
|
540
|
+
cleanEmbeddedPathToFile;
|
|
541
|
+
removeStartEndQuotes(str) {
|
|
542
|
+
return str.replace(/^['"`]/, '').replace(/['"`]$/, '');
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* RESULT OF PROCESSING
|
|
546
|
+
*/
|
|
547
|
+
embeddedPathToFileResult;
|
|
548
|
+
/**
|
|
549
|
+
* @deprecated use cleanEmbeddedPathToFile
|
|
550
|
+
*/
|
|
551
|
+
packageName;
|
|
552
|
+
isIsomorphic;
|
|
553
|
+
startRow;
|
|
554
|
+
startCol;
|
|
555
|
+
/**
|
|
556
|
+
* it will extract part of the file content
|
|
557
|
+
* that is between startRow, startCol and endRow, endCol
|
|
558
|
+
* and contains import/export/require statement
|
|
559
|
+
*/
|
|
560
|
+
getStringPartFrom(wholeContentOfFile) {
|
|
561
|
+
const lines = wholeContentOfFile.split('\n');
|
|
562
|
+
// Convert 1-based row indices to 0-based
|
|
563
|
+
const startRowIndex = this.startRow - 1;
|
|
564
|
+
const endRowIndex = this.endRow - 1;
|
|
565
|
+
// Ensure indices are within bounds
|
|
566
|
+
if (startRowIndex >= lines.length || endRowIndex >= lines.length) {
|
|
567
|
+
throw new Error('Row index out of bounds.');
|
|
568
|
+
}
|
|
569
|
+
let extractedLines = [];
|
|
570
|
+
for (let i = startRowIndex; i <= endRowIndex; i++) {
|
|
571
|
+
let line = lines[i];
|
|
572
|
+
if (i === startRowIndex && i === endRowIndex) {
|
|
573
|
+
// Same row: extract from startCol to endCol
|
|
574
|
+
extractedLines.push(line.substring(this.startCol - 1, this.endCol));
|
|
575
|
+
}
|
|
576
|
+
else if (i === startRowIndex) {
|
|
577
|
+
// First row: extract from startCol to end
|
|
578
|
+
extractedLines.push(line.substring(this.startCol - 1));
|
|
579
|
+
}
|
|
580
|
+
else if (i === endRowIndex) {
|
|
581
|
+
// Last row: extract from beginning to endCol
|
|
582
|
+
extractedLines.push(line.substring(0, this.endCol));
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
// Whole row in between
|
|
586
|
+
extractedLines.push(line);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
return extractedLines.join('\n');
|
|
590
|
+
}
|
|
591
|
+
endRow;
|
|
592
|
+
endCol;
|
|
593
|
+
parenthesisType;
|
|
594
|
+
wrapInParenthesis(str) {
|
|
595
|
+
return this.parenthesisType === 'single'
|
|
596
|
+
? `'${str}'`
|
|
597
|
+
: this.parenthesisType === 'double'
|
|
598
|
+
? `"${str}"`
|
|
599
|
+
: `\`${str}\``;
|
|
600
|
+
}
|
|
601
|
+
importElements = [];
|
|
602
|
+
constructor(type, embeddedPathToFile, start, end, parenthesisType, importElements = []) {
|
|
603
|
+
this.type = type;
|
|
604
|
+
this.isIsomorphic = false;
|
|
605
|
+
this.embeddedPathToFile = embeddedPathToFile;
|
|
606
|
+
this.cleanEmbeddedPathToFile =
|
|
607
|
+
this.removeStartEndQuotes(embeddedPathToFile);
|
|
608
|
+
this.embeddedPathToFileResult = embeddedPathToFile;
|
|
609
|
+
this.startRow = start.line + 1; // TypeScript lines are zero-based
|
|
610
|
+
this.startCol = start.character + 1;
|
|
611
|
+
this.endRow = end.line + 1;
|
|
612
|
+
this.endCol = end.character + 1;
|
|
613
|
+
this.parenthesisType = parenthesisType;
|
|
614
|
+
this.importElements = importElements;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
UtilsTypescript.TsImportExport = TsImportExport;
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region helpers / get quote type
|
|
620
|
+
const getQuoteType = (text) => {
|
|
621
|
+
if (text.startsWith('`'))
|
|
622
|
+
return 'tics';
|
|
623
|
+
if (text.startsWith("'"))
|
|
624
|
+
return 'single';
|
|
625
|
+
return 'double';
|
|
626
|
+
};
|
|
627
|
+
//#endregion
|
|
628
|
+
const extractImportExportElements = (node) => {
|
|
629
|
+
const elements = [];
|
|
630
|
+
if ((0, typescript_1.isImportDeclaration)(node) && node.importClause) {
|
|
631
|
+
// Check if there are named imports inside { }
|
|
632
|
+
if (node.importClause.namedBindings &&
|
|
633
|
+
(0, typescript_1.isNamedImports)(node.importClause.namedBindings)) {
|
|
634
|
+
elements.push(...node.importClause.namedBindings.elements.map(el => el.name.text));
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
else if ((0, typescript_1.isExportDeclaration)(node) && node.exportClause) {
|
|
638
|
+
// Check if there are named exports inside { }
|
|
639
|
+
if ((0, typescript_1.isNamedExports)(node.exportClause)) {
|
|
640
|
+
elements.push(...node.exportClause.elements.map(el => el.name.text));
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return elements;
|
|
644
|
+
};
|
|
645
|
+
UtilsTypescript.recognizeImportsFromFile = (fileAbsPAth) => {
|
|
646
|
+
//#region @backendFunc
|
|
647
|
+
const content = tnp_core_1.Helpers.readFile(fileAbsPAth);
|
|
648
|
+
return UtilsTypescript.recognizeImportsFromContent(content);
|
|
649
|
+
//#endregion
|
|
650
|
+
};
|
|
651
|
+
UtilsTypescript.recognizeImportsFromContent = (fileContent) => {
|
|
652
|
+
//#region @backendFunc
|
|
653
|
+
if (!fileContent) {
|
|
654
|
+
return [];
|
|
655
|
+
}
|
|
656
|
+
const sourceFile = (0, typescript_1.createSourceFile)('file.ts', // a name for the file
|
|
657
|
+
fileContent, typescript_1.ScriptTarget.Latest, true);
|
|
658
|
+
const results = [];
|
|
659
|
+
const visit = (node) => {
|
|
660
|
+
// Check for dynamic import expressions specifically
|
|
661
|
+
if ((0, typescript_1.isCallExpression)(node) &&
|
|
662
|
+
node.expression.kind === typescript_1.SyntaxKind.ImportKeyword) {
|
|
663
|
+
const args = node.arguments;
|
|
664
|
+
if (args.length) {
|
|
665
|
+
const arg = args[0];
|
|
666
|
+
const specifier = arg.getText(sourceFile);
|
|
667
|
+
const parenthesisType = getQuoteType(specifier);
|
|
668
|
+
results.push(new TsImportExport('async-import', specifier, sourceFile.getLineAndCharacterOfPosition(node.getStart()), sourceFile.getLineAndCharacterOfPosition(node.getEnd()), parenthesisType));
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
if ((0, typescript_1.isImportDeclaration)(node) || (0, typescript_1.isExportDeclaration)(node)) {
|
|
672
|
+
const specifier = node.moduleSpecifier
|
|
673
|
+
? node.moduleSpecifier.getText(sourceFile)
|
|
674
|
+
: '';
|
|
675
|
+
const parenthesisType = getQuoteType(specifier);
|
|
676
|
+
const type = node.kind === typescript_1.SyntaxKind.ImportDeclaration ? 'import' : 'export';
|
|
677
|
+
const importExportElements = extractImportExportElements(node);
|
|
678
|
+
results.push(new TsImportExport(type, specifier, sourceFile.getLineAndCharacterOfPosition(node.getStart()), sourceFile.getLineAndCharacterOfPosition(node.getEnd()), parenthesisType, importExportElements));
|
|
679
|
+
}
|
|
680
|
+
if ((0, typescript_1.isCallExpression)(node) &&
|
|
681
|
+
node.expression.getText(sourceFile) === 'require') {
|
|
682
|
+
const args = node.arguments;
|
|
683
|
+
if (args.length > 0) {
|
|
684
|
+
const arg = args[0];
|
|
685
|
+
const specifier = arg.getText(sourceFile);
|
|
686
|
+
const parenthesisType = getQuoteType(specifier);
|
|
687
|
+
results.push(new TsImportExport('require', specifier, sourceFile.getLineAndCharacterOfPosition(arg.getStart()), sourceFile.getLineAndCharacterOfPosition(arg.getEnd()), parenthesisType));
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
(0, typescript_1.forEachChild)(node, visit);
|
|
691
|
+
};
|
|
692
|
+
(0, typescript_1.forEachChild)(sourceFile, visit);
|
|
693
|
+
return results;
|
|
694
|
+
//#endregion
|
|
695
|
+
};
|
|
696
|
+
//#endregion
|
|
381
697
|
})(UtilsTypescript || (exports.UtilsTypescript = UtilsTypescript = {}));
|
|
382
698
|
//#endregion
|
|
383
699
|
//#region utils http
|
|
384
700
|
var UtilsHttp;
|
|
385
701
|
(function (UtilsHttp) {
|
|
386
|
-
var _this = this;
|
|
387
702
|
//#region utils http / start http server
|
|
388
|
-
UtilsHttp.startHttpServer =
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
703
|
+
UtilsHttp.startHttpServer = async (cwd, port) => {
|
|
704
|
+
//#region @backendFunc
|
|
705
|
+
const express = require('express');
|
|
706
|
+
const app = express();
|
|
707
|
+
// Serve static files from the provided cwd
|
|
708
|
+
app.use(express.static(cwd));
|
|
709
|
+
// Catch-all to handle any invalid routes (404 errors)
|
|
710
|
+
app.use((req, res) => {
|
|
711
|
+
res.status(404).send('File not found');
|
|
712
|
+
});
|
|
713
|
+
// Start the server
|
|
714
|
+
const server = app.listen(port, () => {
|
|
715
|
+
console.log(`Server started at http://localhost:${port}, serving files from ${cwd}`);
|
|
716
|
+
});
|
|
717
|
+
return new Promise((resolve, reject) => {
|
|
718
|
+
console.log(`Server started at http://localhost:${port}`);
|
|
719
|
+
// Handle Ctrl+C (SIGINT) gracefully
|
|
720
|
+
process.on('SIGINT', () => {
|
|
721
|
+
server.close(() => resolve());
|
|
400
722
|
});
|
|
401
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
402
|
-
console.log("Server started at http://localhost:".concat(port));
|
|
403
|
-
// Handle Ctrl+C (SIGINT) gracefully
|
|
404
|
-
process.on('SIGINT', function () {
|
|
405
|
-
server.close(function () { return resolve(); });
|
|
406
|
-
});
|
|
407
|
-
})];
|
|
408
723
|
});
|
|
409
|
-
|
|
724
|
+
//#endregion
|
|
725
|
+
};
|
|
410
726
|
//#endregion
|
|
411
727
|
})(UtilsHttp || (exports.UtilsHttp = UtilsHttp = {}));
|
|
412
728
|
//#endregion
|
|
@@ -416,13 +732,13 @@ var UtilsMd;
|
|
|
416
732
|
/**
|
|
417
733
|
* extract assets pathes from .md file
|
|
418
734
|
*/
|
|
419
|
-
UtilsMd.getAssets =
|
|
735
|
+
UtilsMd.getAssets = (mdfileContent) => {
|
|
420
736
|
//#region @backendFunc
|
|
421
737
|
// Regular expressions for detecting assets
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
738
|
+
const markdownImgRegex = /!\[.*?\]\((.*?)\)/g; // Markdown image syntax 
|
|
739
|
+
const htmlImgRegex = /<img.*?src=["'](.*?)["']/g; // HTML image syntax <img src="path">
|
|
740
|
+
const assets = [];
|
|
741
|
+
let match;
|
|
426
742
|
// Extract Markdown image links
|
|
427
743
|
while ((match = markdownImgRegex.exec(mdfileContent)) !== null) {
|
|
428
744
|
assets.push(match[1]); // Get the image path
|
|
@@ -431,21 +747,21 @@ var UtilsMd;
|
|
|
431
747
|
while ((match = htmlImgRegex.exec(mdfileContent)) !== null) {
|
|
432
748
|
assets.push(match[1]); // Get the image path
|
|
433
749
|
}
|
|
434
|
-
return assets.map(
|
|
750
|
+
return assets.map(r => r.replace(new RegExp(/^\.\//), ''));
|
|
435
751
|
//#endregion
|
|
436
752
|
};
|
|
437
753
|
/**
|
|
438
754
|
* Extract links to other Markdown files from a given Markdown content.
|
|
439
755
|
* @param mdfileContent
|
|
440
756
|
*/
|
|
441
|
-
UtilsMd.getLinksToOtherMdFiles =
|
|
757
|
+
UtilsMd.getLinksToOtherMdFiles = (mdfileContent) => {
|
|
442
758
|
//#region @backendFunc
|
|
443
759
|
// Regex pattern to match Markdown and HTML links to .md files
|
|
444
|
-
|
|
760
|
+
const mdLinkPattern = /\[.*?\]\(([^)]+\.md)\)/g; // Matches [text](link.md)
|
|
445
761
|
// const htmlLinkPattern = /<a\s+href=["']([^"']+\.md)["'].*?>/g; // Matches <a href="link.md">
|
|
446
|
-
|
|
762
|
+
const links = new Set(); // Use a Set to avoid duplicate links
|
|
447
763
|
// Find all Markdown-style links
|
|
448
|
-
|
|
764
|
+
let match;
|
|
449
765
|
while ((match = mdLinkPattern.exec(mdfileContent)) !== null) {
|
|
450
766
|
links.add(match[1]);
|
|
451
767
|
}
|
|
@@ -463,23 +779,23 @@ var UtilsMd;
|
|
|
463
779
|
* @param level - The number of levels to go up (default is 1).
|
|
464
780
|
* @returns The modified content with updated asset paths.
|
|
465
781
|
*/
|
|
466
|
-
UtilsMd.moveAssetsPathesToLevel =
|
|
467
|
-
if (level === void 0) { level = 1; }
|
|
782
|
+
UtilsMd.moveAssetsPathesToLevel = (mdfileContent, level = 1) => {
|
|
468
783
|
//#region @backendFunc
|
|
784
|
+
mdfileContent = mdfileContent || '';
|
|
469
785
|
// Regular expressions for detecting assets
|
|
470
|
-
|
|
471
|
-
|
|
786
|
+
const markdownImgRegex = /(!\[.*?\]\()(\.\/|\.\.\/.*?)(\))/g; // Matches 
|
|
787
|
+
const htmlImgRegex = /(<img.*?src=["'])(\.\/|\.\.\/.*?)(["'])/g; // Matches <img src="./path or ../path">
|
|
472
788
|
// Calculate how many "../" segments to prepend based on the level
|
|
473
|
-
|
|
789
|
+
const prefix = '../'.repeat(level);
|
|
474
790
|
// Replace the paths in Markdown images
|
|
475
|
-
|
|
791
|
+
const updatedMarkdown = mdfileContent.replace(markdownImgRegex, (_, prefixText, path, suffix) => {
|
|
476
792
|
// Add the "../" prefix and normalize the path
|
|
477
|
-
return
|
|
793
|
+
return `${prefixText}${prefix}${path.replace(/^\.\//, '').replace(/^\.\.\//, '')}${suffix}`;
|
|
478
794
|
});
|
|
479
795
|
// Replace the paths in HTML images
|
|
480
|
-
|
|
796
|
+
const updatedHtml = updatedMarkdown.replace(htmlImgRegex, (_, prefixText, path, suffix) => {
|
|
481
797
|
// Add the "../" prefix and normalize the path
|
|
482
|
-
return
|
|
798
|
+
return `${prefixText}${prefix}${path.replace(/^\.\//, '').replace(/^\.\.\//, '')}${suffix}`;
|
|
483
799
|
});
|
|
484
800
|
return updatedHtml;
|
|
485
801
|
//#endregion
|
|
@@ -494,25 +810,32 @@ var UtilsQuickFixes;
|
|
|
494
810
|
*
|
|
495
811
|
* @param node_modules/sql.js/dist/sql-wasm.js
|
|
496
812
|
*/
|
|
497
|
-
|
|
813
|
+
UtilsQuickFixes.replaceSQLliteFaultyCode = (contentofSQLWasmJS) => {
|
|
498
814
|
//#region @backendFunc
|
|
499
|
-
|
|
815
|
+
const replace = [
|
|
500
816
|
[
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
"
|
|
817
|
+
`var packageJson = JSON.parse(fs.readFileSync(__nccwpck_require__.ab ` +
|
|
818
|
+
`+ "package.json").toString());`,
|
|
819
|
+
`var packageJson = JSON.parse(fs.existsSync(__nccwpck_require__.ab + ` +
|
|
820
|
+
`"package.json") && fs.readFileSync(__nccwpck_require__.ab + "package.json").toString());`,
|
|
505
821
|
],
|
|
506
822
|
['module = undefined;', '/* module = undefined ; */'],
|
|
507
823
|
];
|
|
508
|
-
replace.forEach(
|
|
824
|
+
replace.forEach(r => {
|
|
509
825
|
contentofSQLWasmJS = contentofSQLWasmJS.replace(r[0], r[1]);
|
|
510
826
|
});
|
|
511
827
|
return contentofSQLWasmJS;
|
|
512
828
|
//#endregion
|
|
513
|
-
}
|
|
514
|
-
UtilsQuickFixes.replaceSQLliteFaultyCode = replaceSQLliteFaultyCode;
|
|
829
|
+
};
|
|
515
830
|
//#endregion
|
|
831
|
+
/**
|
|
832
|
+
* for some reason electron is being bundled - and it is not needed for cli
|
|
833
|
+
*/
|
|
834
|
+
UtilsQuickFixes.replaceElectronWithNothing = (jsContent) => {
|
|
835
|
+
//#region @backendFunc
|
|
836
|
+
return jsContent.replace(`mod${'ule.exports'} = ${'requ' + 'ire'}("electron");`, '');
|
|
837
|
+
//#endregion
|
|
838
|
+
};
|
|
516
839
|
})(UtilsQuickFixes || (exports.UtilsQuickFixes = UtilsQuickFixes = {}));
|
|
517
840
|
//#endregion
|
|
518
841
|
//# sourceMappingURL=utils.js.map
|