@azure-net/cli 5.1.0 → 6.0.0-next.2
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 +189 -0
- package/bin/azure-net.js +236 -221
- package/dist/bin/azure-net.d.ts +2 -0
- package/dist/src/checks/architecture.d.ts +20 -0
- package/dist/src/checks/checkDomain.d.ts +1 -0
- package/dist/src/checks/checkFoldersStructure.d.ts +1 -0
- package/dist/src/checks/checkHooks.d.ts +1 -0
- package/dist/src/checks/checkImports.d.ts +1 -0
- package/dist/src/checks/checkInternal.d.ts +1 -0
- package/dist/src/checks/checkLayerBoundaries.d.ts +1 -0
- package/dist/src/checks/checkLayerImports.d.ts +1 -0
- package/dist/src/checks/checkPresenterNames.d.ts +1 -0
- package/dist/src/checks/checkProject.d.ts +1 -0
- package/dist/src/checks/checkProviderGraph.d.ts +1 -0
- package/dist/src/checks/checkProviderNames.d.ts +1 -0
- package/dist/src/generate/layers/generateRepository.d.ts +1 -0
- package/dist/src/generate/layers/generateRepositoryMethod.d.ts +1 -0
- package/dist/src/generate/layers/generateUseCases.d.ts +1 -0
- package/dist/src/generate/module/generateDomain.d.ts +8 -0
- package/dist/src/generate/module/generateModule.d.ts +1 -0
- package/dist/src/generate/module/generateModulePreset.d.ts +1 -0
- package/dist/src/generate/module/generatePresenter.d.ts +29 -0
- package/dist/src/generate/module/generateRepository.d.ts +15 -0
- package/dist/src/generate/module/generateRepositoryMethod.d.ts +2 -0
- package/dist/src/generate/module/generateSchemaFromType.d.ts +9 -0
- package/dist/src/generate/module/generateStore.d.ts +1 -0
- package/dist/src/generate/module/generateTypesJson.d.ts +2 -0
- package/dist/src/generate/module/generateUseCases.d.ts +1 -0
- package/dist/src/generate/module/repositoryModuleShared.d.ts +89 -0
- package/dist/src/generate/routes/generateRoutes.d.ts +14 -0
- package/dist/src/generate/ui/generateComponent.d.ts +1 -0
- package/dist/src/generate/ui/generateDesignComponent.d.ts +1 -0
- package/dist/src/generate/ui/generateWidget.d.ts +1 -0
- package/dist/src/git/commit.d.ts +23 -0
- package/dist/src/git/push.d.ts +11 -0
- package/dist/src/git/runGit.d.ts +2 -0
- package/dist/src/init/initAliases.d.ts +12 -0
- package/dist/src/init/initEdges.d.ts +2 -0
- package/dist/src/init/initStructure.d.ts +1 -0
- package/dist/src/install/configureCommitTools.d.ts +1 -0
- package/dist/src/install/installFresh.d.ts +1 -0
- package/dist/src/migrate/migrate.d.ts +22 -0
- package/dist/src/migrate/presenters.d.ts +7 -0
- package/dist/src/plugins/addLint.d.ts +5 -0
- package/dist/src/scaffolds/createCoreSchema.d.ts +1 -0
- package/dist/src/scaffolds/createDatasource.d.ts +1 -0
- package/dist/src/scaffolds/createProgram.d.ts +1 -0
- package/dist/src/scaffolds/createResponse.d.ts +1 -0
- package/dist/src/scaffolds/createSchemaRule.d.ts +1 -0
- package/dist/src/scaffolds/createTranslationManager.d.ts +1 -0
- package/{src/scaffolds/index.ts → dist/src/scaffolds/index.d.ts} +0 -2
- package/dist/src/scaffolds/registerDatasource.d.ts +2 -0
- package/dist/src/scaffolds/updateDefaultFactoryConfig.d.ts +1 -0
- package/dist/src/utils/architecture.d.ts +31 -0
- package/dist/src/utils/contextUtils.d.ts +6 -0
- package/dist/src/utils/fileUtils.d.ts +5 -0
- package/dist/src/utils/flattenConfig.d.ts +2 -0
- package/dist/src/utils/legacyAliases.d.ts +1 -0
- package/dist/src/utils/loadConfig.d.ts +16 -0
- package/dist/src/utils/packageImports.d.ts +4 -0
- package/dist/src/utils/sharedFoundation.d.ts +20 -0
- package/dist/src/utils/viteConfig.d.ts +9 -0
- package/package.json +48 -36
- package/src/checks/architecture.js +154 -0
- package/src/checks/checkDomain.js +124 -154
- package/src/checks/checkFoldersStructure.js +64 -52
- package/src/checks/checkHooks.js +12 -12
- package/src/checks/checkImports.js +26 -142
- package/src/checks/checkInternal.js +27 -24
- package/src/checks/checkLayerBoundaries.js +22 -197
- package/src/checks/checkLayerImports.js +14 -134
- package/src/checks/checkPresenterNames.js +156 -143
- package/src/checks/checkProject.js +27 -26
- package/src/checks/checkProviderGraph.js +182 -166
- package/src/checks/checkProviderNames.js +123 -112
- package/src/generate/layers/generateRepository.js +1 -109
- package/src/generate/layers/generateRepositoryMethod.js +1 -90
- package/src/generate/layers/generateUseCases.js +1 -44
- package/src/generate/module/generateDomain.js +81 -105
- package/src/generate/module/generateModule.js +34 -68
- package/src/generate/module/generateModulePreset.js +188 -248
- package/src/generate/module/generatePresenter.js +441 -369
- package/src/generate/module/generateRepository.js +102 -121
- package/src/generate/module/generateRepositoryMethod.js +117 -0
- package/src/generate/module/generateSchemaFromType.js +283 -280
- package/src/generate/module/generateStore.js +41 -0
- package/src/generate/module/generateTypesJson.js +196 -195
- package/src/generate/module/generateUseCases.js +47 -55
- package/src/generate/module/repositoryModuleShared.js +480 -459
- package/src/generate/routes/generateRoutes.js +165 -174
- package/src/generate/ui/generateComponent.js +44 -64
- package/src/generate/ui/generateDesignComponent.js +21 -41
- package/src/generate/ui/generateWidget.js +21 -41
- package/src/git/commit.js +67 -0
- package/src/git/push.js +19 -0
- package/src/git/runGit.js +11 -0
- package/src/init/initAliases.js +19 -135
- package/src/init/initEdges.js +79 -54
- package/src/init/initStructure.js +31 -145
- package/src/install/configureCommitTools.js +1 -0
- package/src/install/installFresh.js +39 -68
- package/src/migrate/migrate.js +914 -0
- package/src/migrate/presenters.js +265 -0
- package/src/plugins/addLint.js +52 -219
- package/src/scaffolds/createCoreSchema.js +65 -91
- package/src/scaffolds/createDatasource.js +67 -101
- package/src/scaffolds/createProgram.js +8 -8
- package/src/scaffolds/createResponse.js +29 -29
- package/src/scaffolds/createSchemaRule.js +19 -19
- package/src/scaffolds/createTranslationManager.js +84 -37
- package/src/scaffolds/index.js +0 -2
- package/src/scaffolds/registerDatasource.js +59 -0
- package/src/scaffolds/updateDefaultFactoryConfig.js +31 -0
- package/src/utils/architecture.js +145 -0
- package/src/utils/contextUtils.js +32 -65
- package/src/utils/fileUtils.js +69 -50
- package/src/utils/flattenConfig.js +38 -0
- package/src/utils/legacyAliases.js +75 -0
- package/src/utils/loadConfig.js +76 -40
- package/src/utils/packageImports.js +63 -0
- package/src/utils/sharedFoundation.js +36 -42
- package/src/utils/viteConfig.js +295 -0
- package/.prettierrc +0 -7
- package/bin/azure-net.ts +0 -308
- package/eslint.config.js +0 -34
- package/src/checks/checkDomain.ts +0 -223
- package/src/checks/checkFoldersStructure.ts +0 -85
- package/src/checks/checkHooks.ts +0 -22
- package/src/checks/checkImports.ts +0 -193
- package/src/checks/checkInternal.ts +0 -48
- package/src/checks/checkLayerBoundaries.ts +0 -255
- package/src/checks/checkLayerImports.ts +0 -185
- package/src/checks/checkPresenterNames.ts +0 -203
- package/src/checks/checkProject.ts +0 -45
- package/src/checks/checkProviderGraph.ts +0 -234
- package/src/checks/checkProviderNames.ts +0 -165
- package/src/generate/layers/generateRepository.ts +0 -123
- package/src/generate/layers/generateRepositoryMethod.ts +0 -102
- package/src/generate/layers/generateUseCases.ts +0 -50
- package/src/generate/layers/repositoryShared.js +0 -506
- package/src/generate/layers/repositoryShared.ts +0 -662
- package/src/generate/module/generateDomain.ts +0 -147
- package/src/generate/module/generateModule.ts +0 -84
- package/src/generate/module/generateModulePreset.ts +0 -338
- package/src/generate/module/generatePresenter.ts +0 -498
- package/src/generate/module/generateRepository.ts +0 -158
- package/src/generate/module/generateSchemaFromType.ts +0 -368
- package/src/generate/module/generateTypesJson.ts +0 -259
- package/src/generate/module/generateUseCases.ts +0 -67
- package/src/generate/module/repositoryModuleShared.ts +0 -669
- package/src/generate/routes/generateRoutes.ts +0 -282
- package/src/generate/ui/generateComponent.ts +0 -100
- package/src/generate/ui/generateDesignComponent.ts +0 -71
- package/src/generate/ui/generateWidget.ts +0 -71
- package/src/init/initAliases.ts +0 -172
- package/src/init/initEdges.ts +0 -74
- package/src/init/initStructure.ts +0 -172
- package/src/install/installFresh.ts +0 -93
- package/src/plugins/addLint.ts +0 -274
- package/src/scaffolds/createCoreSchema.ts +0 -130
- package/src/scaffolds/createDatasource.ts +0 -161
- package/src/scaffolds/createDatasourceProvider.js +0 -127
- package/src/scaffolds/createDatasourceProvider.ts +0 -161
- package/src/scaffolds/createPresenterFactory.js +0 -83
- package/src/scaffolds/createPresenterFactory.ts +0 -102
- package/src/scaffolds/createProgram.ts +0 -19
- package/src/scaffolds/createResponse.ts +0 -66
- package/src/scaffolds/createSchemaRule.ts +0 -44
- package/src/scaffolds/createTranslationManager.ts +0 -80
- package/src/utils/contextUtils.ts +0 -88
- package/src/utils/fileUtils.ts +0 -74
- package/src/utils/loadConfig.ts +0 -68
- package/src/utils/sharedFoundation.ts +0 -70
- package/tsconfig.json +0 -19
- /package/{src/checks/index.ts → dist/src/checks/index.d.ts} +0 -0
- /package/{src/plugins/index.ts → dist/src/plugins/index.d.ts} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# @azure-net/cli
|
|
2
|
+
|
|
3
|
+
CLI installs separately: `npm i -D @azure-net/cli`. Requires Node >=22.15 and @azure-net/kit >=6.0.0-next.1.
|
|
4
|
+
|
|
5
|
+
## Architecture (breaking change)
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
src/app/
|
|
9
|
+
Contexts/
|
|
10
|
+
SharedKernel/
|
|
11
|
+
Orders/
|
|
12
|
+
Domain/{Entities,Ports,Enums}
|
|
13
|
+
Infrastructure/Repositories
|
|
14
|
+
Application/UseCases
|
|
15
|
+
Presentation/
|
|
16
|
+
Admin/{Ui,Scopes,Shell}
|
|
17
|
+
Public/{Ui,Scopes,Shell}
|
|
18
|
+
Shared/{Ui,Scopes,Shell}
|
|
19
|
+
Platform/
|
|
20
|
+
Foundation/{Datasource,Response,Schema,DI}
|
|
21
|
+
Bootstrap/{Routes,Localization}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Each context, including SharedKernel, has the three context layers. Without configured workspaces, Presentation contains Ui, Scopes and Shell directly. Ui components go into Components/Shared, Components/Layout or Components/Page/PageName; widgets into Widgets and design components into Design. Presenters go into Scopes/ScopeName.
|
|
25
|
+
|
|
26
|
+
Application directories/files use PascalCase; barrel index.ts is the exception. Framework files outside app retain their native names, including src/program.ts. Aliases are `#contexts`, `#presentation`, `#platform`.
|
|
27
|
+
|
|
28
|
+
Contexts cannot import other contexts, except SharedKernel. SharedKernel cannot import other contexts. Presentation can import contexts. Workspaces cannot import each other except Shared; Shared cannot import other workspaces. These are static architectural checks, not a security sandbox: computed imports and indirect re-export graphs are not exhaustively resolved.
|
|
29
|
+
|
|
30
|
+
Old contexts/sharedAlias/coreAlias configuration no longer determines generation paths. Existing projects are NOT migrated or deleted automatically. Move old code and imports deliberately before running the new checks.
|
|
31
|
+
|
|
32
|
+
## Configuration
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
export default {
|
|
36
|
+
presentationWorkspaces: ['Admin', 'Public'],
|
|
37
|
+
packageManager: 'pnpm',
|
|
38
|
+
runChecksBeforePush: true
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Workspaces configure initial structure only; subsequent selections discover directories on disk. Context selectors offer existing contexts or creation of a new one. SharedKernel and, for grouped presentation, Shared are initialized automatically. The default schema factory can be selected through defaultSchemaFactory. Presenters are classes registered with RegisterProvider; no presenter factory is generated.
|
|
43
|
+
|
|
44
|
+
### Presenter Generation
|
|
45
|
+
|
|
46
|
+
`generate presenter`, `generate module` and `generate module-preset` generate a
|
|
47
|
+
class accepting the selected UseCases in its constructor. Only the async helpers
|
|
48
|
+
needed by its methods are imported directly from `@azure-net/kit/delivery`.
|
|
49
|
+
Schema generation and provider service-key selection remain unchanged.
|
|
50
|
+
|
|
51
|
+
Each file exports both `OrdersPresenter` and `useOrdersPresenter`. The accessor
|
|
52
|
+
is registered with `RegisterProvider(() => new OrdersPresenter(...), 'scoped')`;
|
|
53
|
+
dependencies are resolved through `ApplicationProvider()` inside that callback.
|
|
54
|
+
Call the accessor in the component. Generated arrow methods support destructuring.
|
|
55
|
+
There is no `create presenter-factory` command or fresh-install presenter-factory step.
|
|
56
|
+
|
|
57
|
+
`migrate --dry-run` also previews this API upgrade for projects already using the
|
|
58
|
+
Contexts/Presentation/Platform layout. Recognized callback presenters become
|
|
59
|
+
classes plus accessors. The migrator preserves lexical state through a private
|
|
60
|
+
state object and rewrites named consumer imports/re-exports to the accessor,
|
|
61
|
+
retaining their local aliases. Async-helper factories are replaced by direct
|
|
62
|
+
function references, preserving explicit custom error types. Unsupported custom
|
|
63
|
+
injections and dynamic consumer imports are listed in the migration report for
|
|
64
|
+
manual review. Original files remain in the migration snapshot.
|
|
65
|
+
|
|
66
|
+
`scoped` means request-cached on the server and new-per-call in the browser, not
|
|
67
|
+
component-context caching. `singleton` shares only on the client (still scoped to
|
|
68
|
+
the request on the server). `transient`/`trancient` always creates a new instance.
|
|
69
|
+
No effect cleanup or hydration is performed by the registration.
|
|
70
|
+
|
|
71
|
+
## Initialization and Foundation
|
|
72
|
+
|
|
73
|
+
| Command | Purpose |
|
|
74
|
+
| -------------------------------------- | ------------------------------------------------------------------- |
|
|
75
|
+
| `azure-net init folders-structure` | Initialize architecture and Svelte aliases, preserve existing files |
|
|
76
|
+
| `azure-net init edges` | Configure AzureNetPlugin in Vite (historical command name) |
|
|
77
|
+
| `azure-net install fresh` | Structure, plugin, program.ts and optional Foundation artifacts |
|
|
78
|
+
| `azure-net create schema-factory` | Foundation/Schema |
|
|
79
|
+
| `azure-net create schema-rule` | Foundation/Schema/CustomRules |
|
|
80
|
+
| `azure-net create response` | Foundation/Response |
|
|
81
|
+
| `azure-net create datasource` | Foundation/Datasource |
|
|
82
|
+
| `azure-net create translation-manager` | Bootstrap/Localization |
|
|
83
|
+
|
|
84
|
+
DI is centralized in Platform/Foundation/DI/ApplicationProvider.ts. Register repository/use-case factories there before presenter generation. The generator reads the actual returned service key (e.g. Orders), not a guessed context provider name. Module generation pauses for manual DI registration; it does not invent datasource configuration or edit user DI logic.
|
|
85
|
+
|
|
86
|
+
## Generation
|
|
87
|
+
|
|
88
|
+
| Command after `azure-net generate` | Result |
|
|
89
|
+
| ---------------------------------- | ------------------------------------------------------------------- |
|
|
90
|
+
| `domain` | Interfaces in the context's Domain/Entities and Ports |
|
|
91
|
+
| `repo` / `repository` | Repository, contract in Ports, optional UseCases |
|
|
92
|
+
| `repository-method` | Add a method and update the contract/UseCases |
|
|
93
|
+
| `use-cases` | ClassMirror-based wrapper for an existing repository |
|
|
94
|
+
| `presenter` | Choose workspace/scope; use central ApplicationProvider |
|
|
95
|
+
| `module` | Domain, repository, UseCases, manual DI confirmation, presenter |
|
|
96
|
+
| `module-preset` | Predefined CRUD types/methods, UseCases, DI confirmation, presenter |
|
|
97
|
+
| `component` | Ui/Components with Shared/Layout/Page selection |
|
|
98
|
+
| `widget` | Ui/Widgets |
|
|
99
|
+
| `design-component` | Ui/Design |
|
|
100
|
+
| `types-json` | Add inferred fields to an existing entity interface |
|
|
101
|
+
| `schema-from-type` | Populate schema rules from interface fields |
|
|
102
|
+
| `routes` | Overwrite Platform/Bootstrap/Routes/index.ts |
|
|
103
|
+
|
|
104
|
+
Interface declarations retain I; filenames omit it (IOrdersRepository in OrdersRepository.ts). Existing artifacts are not silently replaced; barrel exports are appended. Routes are the intentional overwrite exception: do not hand-edit their generated index.ts.
|
|
105
|
+
|
|
106
|
+
Routes support ungrouped arrays, root route-group arrays, or groupRoutesFunc in config. The callback receives url, relativeDir, segments, dynamicParams, rootGroup, groupStack, depth, hasChildren, hasPage and hasServer; return a group name. Groups are exported variables, not a generated group object. Optional route segments produce both variants. Current template output uses `{param}`; rest-parameter semantics and Svelte encoded literal segments require additional handling before treating this as a complete Svelte route matcher.
|
|
107
|
+
|
|
108
|
+
## Git workflow
|
|
109
|
+
|
|
110
|
+
`azure-net add commit-tools` installs NO packages. It backs up previous Prettier settings under .azure-net/PrettierBackups and replaces the configuration. Existing dependencies/scripts are not removed; install needed formatter tooling yourself.
|
|
111
|
+
|
|
112
|
+
`azure-net commit` commits staged changes only. Choose a type, enter a nonempty subject of at most 100 characters, optionally enter body, breaking changes and footer. Format is `feat(emoji): subject` (a breaking commit adds !).
|
|
113
|
+
|
|
114
|
+
`azure-net push` runs project checks, stages with `git add .`, prompts for the commit, commits, then pushes. A failed step stops the sequence. Missing runChecksBeforePush means true; false or `--no-check` skips checks. Review your changes and .gitignore first: git add . intentionally stages all unignored changes. These commands do not set up Husky or install commitlint, semantic-release or git-cz.
|
|
115
|
+
|
|
116
|
+
## Checks
|
|
117
|
+
|
|
118
|
+
Individual checks: presenter-names, provider-names, provider-graph, domain, imports, hooks, layer-imports, layer-boundaries, folders-structure.
|
|
119
|
+
|
|
120
|
+
`azure-net check internal` runs all checks. `azure-net check project` runs packageManager run format, internal, packageManager run lint and packageManager run check sequentially. Format can modify files. User hooks.server/hooks.client are forbidden; use program.ts and AzureNetPlugin.
|
|
121
|
+
|
|
122
|
+
## Manual acceptance checklist
|
|
123
|
+
|
|
124
|
+
1. In a disposable project, initialize flat Presentation; repeat with Admin/Public workspaces.
|
|
125
|
+
2. Generate a domain/repo in Orders. Verify Entities/Ports, filenames, imports and contracts.
|
|
126
|
+
3. Register UseCases in central DI; create an Admin/Scopes/Orders presenter and schemas.
|
|
127
|
+
4. Generate module-preset, UI artifacts, translations and routes. Repeat routes to verify overwrite.
|
|
128
|
+
5. Introduce a cross-context import and an Admin-to-Public import: internal must fail. Imports from SharedKernel/Shared must pass.
|
|
129
|
+
6. Verify schema-from-type, types-json and repository-method on existing generated artifacts.
|
|
130
|
+
7. Test commit/push only in a disposable Git repository with a test remote. Exercise failing checks and --no-check.
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
`pnpm typecheck`, `pnpm lint`, `pnpm test`. Build synchronizes TypeScript into the checked-in JavaScript used by bin/azure-net.js. Always build before packing. Tests compile generated modules against the adjacent built kit when available.
|
|
135
|
+
|
|
136
|
+
## Migrate a legacy project
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
azure-net migrate --dry-run
|
|
140
|
+
azure-net migrate
|
|
141
|
+
# Non-interactive apply, after reviewing the plan:
|
|
142
|
+
azure-net migrate --yes
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Run from the project root. Dry-run does not write files. Apply requires confirmation (or --yes), rejects occupied targets and detects source changes since planning. Commit or otherwise back up your work first.
|
|
146
|
+
|
|
147
|
+
Legacy application areas become Presentation workspaces; domain subfolders become Contexts. Repositories and UseCases are matched by name, including legacy singular UseCase filenames. UI and presentation move into Ui and Scopes. Foundation constructs move into Platform/Foundation, runtime into Bootstrap. Shared presentation becomes Shared. Ambiguous/colliding files are preserved byte-for-byte in src/app/.backup with their original hierarchy. The CLI never silently chooses a winner or automatically merges distinct domain models.
|
|
148
|
+
|
|
149
|
+
Static imports/re-exports, literal dynamic imports, Svelte script imports and local stylesheet/asset references are rewritten. Named/default barrel exports are followed. Dynamic import expressions and glob patterns require review. Shared business dependencies that would violate new context boundaries are reported; the migration does not invent domain boundaries or move arbitrary types into SharedKernel to hide violations.
|
|
150
|
+
|
|
151
|
+
Supported declarative legacy providers are consolidated into a single Foundation/DI/ApplicationProvider.ts. Datasource construction stays inside register, HTTP/cookie callbacks are retained, repository sharing is retained with private lazy getters. There are no separate datasource/infrastructure providers. Custom register blocks, boot hooks, unsupported provider logic and duplicate service keys require manual review; original provider files are archived. Structural migration is not an automatic kit API upgrade.
|
|
152
|
+
|
|
153
|
+
Full originals of changed/removed files and a manifest are saved under .azure-net/migrations/migration-\*/original. Report.md links relocated/archived files and explains review items. Write failures restore original contents. Obsolete source directories are removed only after their files have been written to their destinations. .backup is ignored by CLI checks and excluded in tsconfig; inspect it before deciding what to retain. Keep migration snapshots private, since original source may contain sensitive configuration.
|
|
154
|
+
|
|
155
|
+
Afterwards run check internal, your project's typecheck and build. These can still fail on ambiguous files, old APIs and genuine new architecture violations; the report is the handoff for manual resolution. Repeating migrate on an already migrated tree stops without changing it.
|
|
156
|
+
|
|
157
|
+
The datasource-provider creation command has been removed, including its fresh-install prompt. Configure datasource options in ApplicationProvider.register instead.
|
|
158
|
+
|
|
159
|
+
## Package subpath imports (SvelteKit 3)
|
|
160
|
+
|
|
161
|
+
Generation uses `#contexts`, `#presentation` and `#platform`. Initialization and migration merge mappings into `package.json#imports`, preserving unrelated package fields and custom imports. Conflicting reserved mappings cause an error rather than being overwritten. No aliases are added to Vite or Svelte config. Fresh install still configures AzureNetPlugin in Vite because it is a plugin, not an alias.
|
|
162
|
+
|
|
163
|
+
Each prefix has a root index.ts target and a wildcard mapping. The wildcard default is `./src/app/Contexts/*` (or Presentation/Platform); its types condition also tries `*.ts` and `*/index.ts`. This preserves extensionless imports and directory barrels in TypeScript's bundler resolution. SvelteKit/Vite bundles the application source; this is not a promise that plain Node can execute raw extensionless TypeScript without a loader.
|
|
164
|
+
|
|
165
|
+
For example: `import { ApplicationProvider } from '#platform/Foundation/DI'`. A scaffolded project's existing `#lib` entry is preserved. See [SvelteKit subpath imports](https://svelte.dev/docs/kit/$lib).
|
|
166
|
+
|
|
167
|
+
The CLI no longer automatically converts or removes a legacy svelte.config during structure migration. Upgrade legacy SvelteKit configuration separately with its official migration tool. Existing deprecated alias settings are not silently removed while old application code may still use them.
|
|
168
|
+
|
|
169
|
+
The first datasource is constructed inside an empty generated ApplicationProvider.register. Configure its HTTP options, pass it to repositories and return UseCases factories. User-owned DI is not overwritten. No DatasourceProvider is generated. Until service registration, `void datasource` avoids an unused-variable diagnostic.
|
|
170
|
+
|
|
171
|
+
For local testing, use a newly named tarball when its contents change. Replacing an archive under the same file: path and version can reuse package-manager cached contents. Verify the installed implementation with the project-local `pnpm exec azure-net`, not an unrelated global executable.
|
|
172
|
+
|
|
173
|
+
## Reactive state and DI
|
|
174
|
+
|
|
175
|
+
- `azure-net generate store` selects a presentation workspace and an existing/new scope, then writes a PascalCase `.svelte.ts` class and a `RegisterProvider(..., 'singleton')` accessor. Without workspaces the path is `src/app/Presentation/Scopes/{Scope}/{Name}.svelte.ts`.
|
|
176
|
+
- Presenter generation and migration emit `RegisterProvider`.
|
|
177
|
+
- Initial structure and migration emit `CreateDiContainer` in `Platform/Foundation/DI/ApplicationProvider.ts`; datasource construction remains inside `register`.
|
|
178
|
+
- `defaultPresenterFactory` is no longer supported or generated; migration removes the legacy setting.
|
|
179
|
+
- Plugin initialization enables `compilerOptions.experimental.async: true` for `useBoot`/`hydratable` and preserves other literal options. Complex spread configurations need manual editing rather than a guessed rewrite.
|
|
180
|
+
|
|
181
|
+
### Built-in translation manager
|
|
182
|
+
|
|
183
|
+
The localization scaffold imports only `@azure-net/kit/i18n`. Await
|
|
184
|
+
`TranslationManager().preloadTranslation()` in useServer before resolve;
|
|
185
|
+
it writes `state.currLocale` and dictionary snapshots automatically. Call
|
|
186
|
+
`TranslationManager().syncFromState(state)` in useBoot and `initializeClient()`
|
|
187
|
+
in useClient. Templates include these integration hints. In components use
|
|
188
|
+
`t(key)` and `manager.locale`, not `$t` / `$locale`. No separate translations
|
|
189
|
+
package, exportState or restoreState is required.
|