@venizia/ardor 0.4.8-1 → 0.4.8-3
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 +14 -3
- package/dist/codemod/bin.js +1 -1
- package/dist/codemod/cli.d.ts +1 -1
- package/dist/codemod/cli.js +2 -1
- package/dist/codemod/logger.js +1 -1
- package/dist/codemod/renames.d.ts +12 -0
- package/dist/codemod/renames.js +18 -0
- package/dist/codemod/transform.d.ts +1 -1
- package/dist/codemod/transform.js +58 -6
- package/dist/index.d.ts +21 -0
- package/dist/index.js +21 -0
- package/dist/presets/app/preset.json +13 -13
- package/dist/presets/lib/preset.json +9 -9
- package/dist/testing.d.ts +4 -2
- package/dist/vite/common/constants.d.ts +6 -0
- package/dist/vite/common/constants.js +6 -0
- package/dist/vite/common/types.d.ts +20 -4
- package/dist/vite/plugin.d.ts +10 -0
- package/dist/vite/plugin.js +10 -0
- package/package.json +17 -17
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ control comes from `@venizia/ignis-inversion`, and the data layer speaks the que
|
|
|
13
13
|
bun add @venizia/ardor @venizia/ignis-inversion @venizia/ignis-filter @venizia/ignis-kernel @venizia/ignis-helpers reflect-metadata
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
The React-side peers (`react`, `react-dom`, `react-redux`, `@reduxjs/toolkit`, `@tanstack/react-query`, `ra-core`, `ra-i18n-polyglot`, `react-router-dom`) are installed too; the full `bun add` line is in the [setup guide](https://ardor.venizia.ai/guides/get-started/setup).
|
|
17
|
+
|
|
16
18
|
## The `Ardor` namespace
|
|
17
19
|
|
|
18
20
|
`Ardor` gathers every React hook of the react and admin packages under one name: `Ardor.useRepository(...)`, `Ardor.useTranslate()`. It is the same function as the bare `useRepository`, the Rules of Hooks check the call, and a bundler keeps only the hooks you use, so it adds no bytes to an app.
|
|
@@ -20,8 +22,10 @@ bun add @venizia/ardor @venizia/ignis-inversion @venizia/ignis-filter @venizia/i
|
|
|
20
22
|
```tsx
|
|
21
23
|
import { Ardor } from '@venizia/ardor';
|
|
22
24
|
|
|
25
|
+
import { OrdersRepository } from './orders.repository';
|
|
26
|
+
|
|
23
27
|
export const Orders = () => {
|
|
24
|
-
const repository = Ardor.useRepository({
|
|
28
|
+
const repository = Ardor.useRepository({ target: OrdersRepository });
|
|
25
29
|
|
|
26
30
|
return <div>{String(repository)}</div>;
|
|
27
31
|
};
|
|
@@ -29,7 +33,13 @@ export const Orders = () => {
|
|
|
29
33
|
|
|
30
34
|
## Moving to the new names
|
|
31
35
|
|
|
32
|
-
`bun run ardor codemod namespace src` lists the removed bare names that have a replacement (`getRuntimeConfig` to `RuntimeConfig.get`, `isDefined` to `ValueUtility.isDefined`, `NullableType` to `undefined | null | void`, `Logger.getInstance({ scope })` to `LoggerFactory.getLogger([scope])`, ...) and the removed names with none, and writes nothing; `--write` applies it, `--check` fails while any is left, and `--hooks` also moves hooks imported from `@venizia/ardor` to `Ardor.useX`. It needs the `typescript` package.
|
|
36
|
+
`bun run ardor codemod namespace src` lists the removed bare names that have a replacement (`getRuntimeConfig` to `RuntimeConfig.get`, `isDefined` to `ValueUtility.isDefined`, `NullableType` to `undefined | null | void`, `Logger.getInstance({ scope })` to `LoggerFactory.getLogger([scope])`, ...) and the removed names with none, and writes nothing; `--write` applies it (it refuses a file with local changes unless you add `--allow-dirty`), `--check` fails while any is left, and `--hooks` also moves hooks imported from `@venizia/ardor` to `Ardor.useX`. It needs the `typescript` package.
|
|
37
|
+
|
|
38
|
+
## Subpaths
|
|
39
|
+
|
|
40
|
+
- `@venizia/ardor/repository` - `HttpRepository` and the datasource settings; needs the optional peer `@venizia/ignis-connectors`.
|
|
41
|
+
- `@venizia/ardor/testing` - `assertArdorApplicationBoots` and `FakeResizeObserver`, for your test suite.
|
|
42
|
+
- `@venizia/ardor/vite` - `buildInfoFile`, a Vite plugin that writes the build info file; needs the optional peers `@venizia/ignis-boot` and `vite`.
|
|
33
43
|
|
|
34
44
|
## Quick start
|
|
35
45
|
|
|
@@ -108,7 +118,8 @@ export class Application extends BaseArdorApplication {
|
|
|
108
118
|
```
|
|
109
119
|
|
|
110
120
|
The full guide, including the root component and the typed hooks, is in the
|
|
111
|
-
[
|
|
121
|
+
[Quickstart](https://ardor.venizia.ai/guides/get-started/5-minute-quickstart) and the
|
|
122
|
+
[references](https://ardor.venizia.ai/references/hooks).
|
|
112
123
|
|
|
113
124
|
## Migrating from `@minimaltech/ra-core-infra`
|
|
114
125
|
|
package/dist/codemod/bin.js
CHANGED
|
@@ -3,7 +3,7 @@ import { NamespaceCommand } from './cli.js';
|
|
|
3
3
|
const USAGE = `Usage: ardor <command>
|
|
4
4
|
|
|
5
5
|
Commands:
|
|
6
|
-
codemod namespace move the
|
|
6
|
+
codemod namespace move the removed bare names to the class members that replace them
|
|
7
7
|
|
|
8
8
|
Run "ardor codemod namespace --help" for the options.`;
|
|
9
9
|
/** The `ardor` bin of `@venizia/ardor`: `ardor codemod namespace [paths...] [--write | --check]`. */
|
package/dist/codemod/cli.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** `ardor codemod namespace`: a dry run unless `--write`; `--check` is the dry run that fails on work left. */
|
|
2
2
|
export declare class NamespaceCommand {
|
|
3
|
-
static readonly USAGE = "Usage: ardor codemod namespace [paths...] [--hooks] [--write [--allow-dirty] | --check]\n\nMoves the names removed from @venizia/ardor to what replaces them:\n\n isDefined, isString, isNumber, isObject, isValidDate ValueUtility.<name>\n isBrowser BrowserUtility.isBrowser\n toDataUrl FileUtility.toDataUrl\n getRuntimeConfig RuntimeConfig.get\n createAppDispatch, createAppSelectors DispatchHooks.create, SelectorHooks.create\n resolveApplicationProviders ApplicationProviders.resolve\n hasPendingFeatureMessages, loadFeatureMessages Features.hasPendingMessages, Features.loadMessages\n NumberIdType, StringIdType, NullableType number, string, undefined | null | void\n BaseHelper, LogLevels, ILogger, TLogLevel the same names from @venizia/ignis-helpers/core\n Logger.getInstance({ scope }), new Logger({ scope }) LoggerFactory.getLogger([scope]) (enableDebug is dropped, with a note)\n Logger (a type) ILogger\n\nRemoved with nothing to write in their place, so only listed with their line: isEditableTarget,\nTDataCount, ISyncFC, App.DEFAULT_LOCALE, HeaderConstants.REQUEST_DEVICE_INFO, HeaderConstants.RESPONSE_FORMAT,\nthe enableDebug prop of ArdorApplication (pass logger instead), and a Logger use with no one-line form.\n\nIt rewrites a name imported from @venizia/ardor, @venizia/ardor-kernel, @venizia/ardor-react or\n@venizia/ardor-admin, its uses, and the import. It reads syntax only: a name the file also declares\nitself, a re-export by name and a class name already taken are listed with their line and left for you.\n\n --hooks also move a hook imported from @venizia/ardor to the Ardor namespace (useRepository()\n becomes Ardor.useRepository()). A hook imported from @venizia/ardor-react or\n @venizia/ardor-admin is never touched: those packages cannot import Ardor.\n --write write the changed files (without it, nothing is written)\n --allow-dirty with --write, also write a file that has local changes, such as one another codemod\n just changed (devz codemod namespace-functions --write leaves the tree dirty)\n --check dry run that exits 1 when anything would change or is left (for CI)\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the\nfiles git knows (tracked, or untracked and not ignored), and --write refuses a file with local\nchanges (changed, staged or untracked), so git can undo the codemod: the file is listed as \"refused\"\nwith its path, the summary counts it and the run exits 1. Commit or stash it and run again, or run\nagain with --allow-dirty to write it anyway (it keeps the other codemod's edits). To run two codemods\none after the other in a dirty tree, give this one --write --allow-dirty.\nRun your formatter afterwards: the new names are appended to the import they join.";
|
|
3
|
+
static readonly USAGE = "Usage: ardor codemod namespace [paths...] [--hooks] [--write [--allow-dirty] | --check]\n\nMoves the names removed from @venizia/ardor to what replaces them:\n\n isDefined, isString, isNumber, isObject, isValidDate ValueUtility.<name>\n isBrowser BrowserUtility.isBrowser\n toDataUrl FileUtility.toDataUrl\n getRuntimeConfig RuntimeConfig.get\n createAppDispatch, createAppSelectors DispatchHooks.create, SelectorHooks.create\n resolveApplicationProviders ApplicationProviders.resolve\n hasPendingFeatureMessages, loadFeatureMessages Features.hasPendingMessages, Features.loadMessages\n NumberIdType, StringIdType, NullableType number, string, undefined | null | void\n BaseHelper, LogLevels, ILogger, TLogLevel the same names from @venizia/ignis-helpers/core\n Logger.getInstance({ scope }), new Logger({ scope }) LoggerFactory.getLogger([scope]) (enableDebug is dropped, with a note)\n Logger (a type) ILogger\n ISendResponse INetworkResponse\n\nRemoved with nothing to write in their place, so only listed with their line: isEditableTarget,\nTDataCount, ISyncFC, IListFilter.offset (use skip; listed wherever a file that imports IListFilter or ListFilterBuilder reads or sets .offset), useSizer (use useElementSize), useInjectableContainer (renamed useApplicationContainer), App.DEFAULT_LOCALE, HeaderConstants.REQUEST_DEVICE_INFO, HeaderConstants.RESPONSE_FORMAT,\nthe enableDebug prop of ArdorApplication (pass logger instead), and a Logger use with no one-line form.\n\nIt rewrites a name imported from @venizia/ardor, @venizia/ardor-kernel, @venizia/ardor-react or\n@venizia/ardor-admin, its uses, and the import. It reads syntax only: a name the file also declares\nitself, a re-export by name and a class name already taken are listed with their line and left for you.\n\n --hooks also move a hook imported from @venizia/ardor to the Ardor namespace (useRepository()\n becomes Ardor.useRepository()). A hook imported from @venizia/ardor-react or\n @venizia/ardor-admin is never touched: those packages cannot import Ardor.\n --write write the changed files (without it, nothing is written)\n --allow-dirty with --write, also write a file that has local changes, such as one another codemod\n just changed (devz codemod namespace-functions --write leaves the tree dirty)\n --check dry run that exits 1 when anything would change or is left (for CI)\n --help print this text and exit\n\nWith no flag it lists what would change and writes nothing. Inside a git repository it reads the\nfiles git knows (tracked, or untracked and not ignored), and --write refuses a file with local\nchanges (changed, staged or untracked), so git can undo the codemod: the file is listed as \"refused\"\nwith its path, the summary counts it and the run exits 1. Commit or stash it and run again, or run\nagain with --allow-dirty to write it anyway (it keeps the other codemod's edits). To run two codemods\none after the other in a dirty tree, give this one --write --allow-dirty.\nRun your formatter afterwards: the new names are appended to the import they join.";
|
|
4
4
|
/** Runs the command and returns the exit code; prints to the console. */
|
|
5
5
|
static run(opts: {
|
|
6
6
|
root: string;
|
package/dist/codemod/cli.js
CHANGED
|
@@ -17,9 +17,10 @@ Moves the names removed from @venizia/ardor to what replaces them:
|
|
|
17
17
|
BaseHelper, LogLevels, ILogger, TLogLevel the same names from @venizia/ignis-helpers/core
|
|
18
18
|
Logger.getInstance({ scope }), new Logger({ scope }) LoggerFactory.getLogger([scope]) (enableDebug is dropped, with a note)
|
|
19
19
|
Logger (a type) ILogger
|
|
20
|
+
ISendResponse INetworkResponse
|
|
20
21
|
|
|
21
22
|
Removed with nothing to write in their place, so only listed with their line: isEditableTarget,
|
|
22
|
-
TDataCount, ISyncFC, App.DEFAULT_LOCALE, HeaderConstants.REQUEST_DEVICE_INFO, HeaderConstants.RESPONSE_FORMAT,
|
|
23
|
+
TDataCount, ISyncFC, IListFilter.offset (use skip; listed wherever a file that imports IListFilter or ListFilterBuilder reads or sets .offset), useSizer (use useElementSize), useInjectableContainer (renamed useApplicationContainer), App.DEFAULT_LOCALE, HeaderConstants.REQUEST_DEVICE_INFO, HeaderConstants.RESPONSE_FORMAT,
|
|
23
24
|
the enableDebug prop of ArdorApplication (pass logger instead), and a Logger use with no one-line form.
|
|
24
25
|
|
|
25
26
|
It rewrites a name imported from @venizia/ardor, @venizia/ardor-kernel, @venizia/ardor-react or
|
package/dist/codemod/logger.js
CHANGED
|
@@ -179,7 +179,7 @@ export class LoggerTransform {
|
|
|
179
179
|
findings.push({
|
|
180
180
|
line: lineOf(call),
|
|
181
181
|
name: 'enableDebug',
|
|
182
|
-
reason: '
|
|
182
|
+
reason: 'dropped. debug lines are off by default now (a browser, or `DEBUG` unset); turn them on with `LoggerFactory.use({ level: LogLevels.DEBUG })` at startup',
|
|
183
183
|
kind: 'note',
|
|
184
184
|
});
|
|
185
185
|
}
|
|
@@ -34,11 +34,23 @@ export declare class TypeRenames {
|
|
|
34
34
|
name: string;
|
|
35
35
|
}): string | undefined;
|
|
36
36
|
}
|
|
37
|
+
/** Types removed in favour of another export of the same packages: the import and each use are renamed. */
|
|
38
|
+
export declare class TypeExportRenames {
|
|
39
|
+
static readonly TARGETS: Readonly<Record<string, string>>;
|
|
40
|
+
static find(opts: {
|
|
41
|
+
name: string;
|
|
42
|
+
}): string | undefined;
|
|
43
|
+
}
|
|
37
44
|
/** Exports and members removed with no code the codemod can write in their place. */
|
|
38
45
|
export declare class RemovedNames {
|
|
39
46
|
static readonly EXPORTS: Readonly<Record<string, string>>;
|
|
40
47
|
/** Class name to removed static member to the reason. */
|
|
41
48
|
static readonly MEMBERS: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
49
|
+
/** A property removed from the list filter: listed in a file that imports one of `owners`, as the file may use it. */
|
|
50
|
+
static readonly PROPERTIES: Readonly<Record<string, {
|
|
51
|
+
owners: ReadonlySet<string>;
|
|
52
|
+
reason: string;
|
|
53
|
+
}>>;
|
|
42
54
|
static findExport(opts: {
|
|
43
55
|
name: string;
|
|
44
56
|
}): string | undefined;
|
package/dist/codemod/renames.js
CHANGED
|
@@ -85,12 +85,23 @@ export class TypeRenames {
|
|
|
85
85
|
return Object.hasOwn(this.TARGETS, opts.name) ? this.TARGETS[opts.name] : undefined;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
/** Types removed in favour of another export of the same packages: the import and each use are renamed. */
|
|
89
|
+
export class TypeExportRenames {
|
|
90
|
+
static { this.TARGETS = {
|
|
91
|
+
ISendResponse: 'INetworkResponse',
|
|
92
|
+
}; }
|
|
93
|
+
static find(opts) {
|
|
94
|
+
return Object.hasOwn(this.TARGETS, opts.name) ? this.TARGETS[opts.name] : undefined;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
88
97
|
/** Exports and members removed with no code the codemod can write in their place. */
|
|
89
98
|
export class RemovedNames {
|
|
90
99
|
static { this.EXPORTS = {
|
|
91
100
|
isEditableTarget: 'nothing in ARDOR called it; check the event target in your own code',
|
|
92
101
|
TDataCount: 'nothing in ARDOR used it; declare the shape you need',
|
|
93
102
|
ISyncFC: 'write the function type, (props: TProps) => ReactNode',
|
|
103
|
+
useInjectableContainer: 'renamed: call useApplicationContainer',
|
|
104
|
+
useSizer: 'use useElementSize({ ref, box: "border-box", round: true }) with a ref in place of the id',
|
|
94
105
|
}; }
|
|
95
106
|
/** Class name to removed static member to the reason. */
|
|
96
107
|
static { this.MEMBERS = {
|
|
@@ -100,6 +111,13 @@ export class RemovedNames {
|
|
|
100
111
|
RESPONSE_FORMAT: 'nothing in ARDOR sent or read this header',
|
|
101
112
|
},
|
|
102
113
|
}; }
|
|
114
|
+
/** A property removed from the list filter: listed in a file that imports one of `owners`, as the file may use it. */
|
|
115
|
+
static { this.PROPERTIES = {
|
|
116
|
+
offset: {
|
|
117
|
+
owners: new Set(['IListFilter', 'ListFilterBuilder']),
|
|
118
|
+
reason: 'the list filter has no offset, use skip',
|
|
119
|
+
},
|
|
120
|
+
}; }
|
|
103
121
|
static findExport(opts) {
|
|
104
122
|
return Object.hasOwn(this.EXPORTS, opts.name) ? this.EXPORTS[opts.name] : undefined;
|
|
105
123
|
}
|
|
@@ -15,7 +15,7 @@ export interface INamespaceResult {
|
|
|
15
15
|
findings: IFinding[];
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Rewrites the
|
|
18
|
+
* Rewrites the removed bare names of `@venizia/ardor` to their class members, in source text:
|
|
19
19
|
* `isDefined(x)` becomes `ValueUtility.isDefined(x)` and the import follows. With `hooks`, a hook
|
|
20
20
|
* imported from `@venizia/ardor` itself becomes `Ardor.useX` (never one imported from the react or
|
|
21
21
|
* admin package, which cannot import `Ardor`).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FunctionRenames, HookRenames, NamespaceModules, RemovedNames, TypeRenames, } from './renames.js';
|
|
1
|
+
import { FunctionRenames, HookRenames, NamespaceModules, RemovedNames, TypeExportRenames, TypeRenames, } from './renames.js';
|
|
2
2
|
/**
|
|
3
|
-
* Rewrites the
|
|
3
|
+
* Rewrites the removed bare names of `@venizia/ardor` to their class members, in source text:
|
|
4
4
|
* `isDefined(x)` becomes `ValueUtility.isDefined(x)` and the import follows. With `hooks`, a hook
|
|
5
5
|
* imported from `@venizia/ardor` itself becomes `Ardor.useX` (never one imported from the react or
|
|
6
6
|
* admin package, which cannot import `Ardor`).
|
|
@@ -66,13 +66,15 @@ export class NamespaceTransform {
|
|
|
66
66
|
});
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const exportName = TypeExportRenames.find({ name: imported });
|
|
70
|
+
const typeText = exportName ?? TypeRenames.find({ name: imported });
|
|
70
71
|
if (typeText) {
|
|
71
72
|
renames.push({
|
|
72
73
|
specifier,
|
|
73
74
|
declaration: statement,
|
|
74
75
|
local: specifier.name.text,
|
|
75
76
|
typeText,
|
|
77
|
+
importName: exportName,
|
|
76
78
|
references: [],
|
|
77
79
|
});
|
|
78
80
|
continue;
|
|
@@ -139,7 +141,9 @@ export class NamespaceTransform {
|
|
|
139
141
|
else if ((ts.isFunctionDeclaration(node) ||
|
|
140
142
|
ts.isClassDeclaration(node) ||
|
|
141
143
|
ts.isFunctionExpression(node) ||
|
|
142
|
-
ts.isClassExpression(node)
|
|
144
|
+
ts.isClassExpression(node) ||
|
|
145
|
+
ts.isTypeAliasDeclaration(node) ||
|
|
146
|
+
ts.isInterfaceDeclaration(node)) &&
|
|
143
147
|
node.name) {
|
|
144
148
|
declared.add(node.name.text);
|
|
145
149
|
}
|
|
@@ -162,6 +166,18 @@ export class NamespaceTransform {
|
|
|
162
166
|
});
|
|
163
167
|
return false;
|
|
164
168
|
}
|
|
169
|
+
const { importName } = rename;
|
|
170
|
+
const takenBy = importName ? bindings.imported.get(importName) : undefined;
|
|
171
|
+
if (importName &&
|
|
172
|
+
(bindings.declared.has(importName) ||
|
|
173
|
+
(takenBy && !NamespaceModules.isValid(takenBy.module)))) {
|
|
174
|
+
findings.push({
|
|
175
|
+
line,
|
|
176
|
+
name: rename.local,
|
|
177
|
+
reason: `"${importName}" is already taken in this file; import it under another name and use it in place of ${rename.local}`,
|
|
178
|
+
});
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
165
181
|
if (!owner || !rename.target) {
|
|
166
182
|
return true;
|
|
167
183
|
}
|
|
@@ -240,7 +256,8 @@ export class NamespaceTransform {
|
|
|
240
256
|
}
|
|
241
257
|
if (rename.typeText !== undefined) {
|
|
242
258
|
// A type is a name in a type position only: `NullableType[]` needs parentheses once replaced.
|
|
243
|
-
if (ts.isTypeReferenceNode(parent) && parent.typeName === node)
|
|
259
|
+
if ((ts.isTypeReferenceNode(parent) && parent.typeName === node) ||
|
|
260
|
+
(ts.isExpressionWithTypeArguments(parent) && parent.expression === node)) {
|
|
244
261
|
const grand = parent.parent;
|
|
245
262
|
const wrap = rename.typeText.includes('|') &&
|
|
246
263
|
(ts.isArrayTypeNode(grand) ||
|
|
@@ -278,7 +295,32 @@ export class NamespaceTransform {
|
|
|
278
295
|
if (owners.size === 0) {
|
|
279
296
|
return;
|
|
280
297
|
}
|
|
298
|
+
const imported = new Set(owners.values());
|
|
281
299
|
const visit = (node) => {
|
|
300
|
+
let name;
|
|
301
|
+
if (ts.isPropertyAccessExpression(node) ||
|
|
302
|
+
ts.isPropertyAssignment(node) ||
|
|
303
|
+
ts.isShorthandPropertyAssignment(node)) {
|
|
304
|
+
name = node.name;
|
|
305
|
+
}
|
|
306
|
+
else if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) {
|
|
307
|
+
name = node.propertyName ?? node.name;
|
|
308
|
+
}
|
|
309
|
+
else if (ts.isElementAccessExpression(node) &&
|
|
310
|
+
ts.isStringLiteral(node.argumentExpression)) {
|
|
311
|
+
name = node.argumentExpression;
|
|
312
|
+
}
|
|
313
|
+
const key = name && (ts.isIdentifier(name) || ts.isStringLiteral(name)) ? name : undefined;
|
|
314
|
+
const property = key && Object.hasOwn(RemovedNames.PROPERTIES, key.text)
|
|
315
|
+
? RemovedNames.PROPERTIES[key.text]
|
|
316
|
+
: undefined;
|
|
317
|
+
if (key && property && [...property.owners].some((owner) => imported.has(owner))) {
|
|
318
|
+
findings.push({
|
|
319
|
+
line: sourceFile.getLineAndCharacterOfPosition(key.getStart(sourceFile)).line + 1,
|
|
320
|
+
name: `.${key.text}`,
|
|
321
|
+
reason: `removed: ${property.reason}`,
|
|
322
|
+
});
|
|
323
|
+
}
|
|
282
324
|
if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression)) {
|
|
283
325
|
const owner = owners.get(node.expression.text);
|
|
284
326
|
const reason = owner
|
|
@@ -323,7 +365,17 @@ export class NamespaceTransform {
|
|
|
323
365
|
for (const owner of owners) {
|
|
324
366
|
added.add(owner);
|
|
325
367
|
}
|
|
326
|
-
const
|
|
368
|
+
const types = [];
|
|
369
|
+
for (const { declaration: from, importName, specifier } of used) {
|
|
370
|
+
if (from === declaration &&
|
|
371
|
+
importName &&
|
|
372
|
+
!bindings.imported.has(importName) &&
|
|
373
|
+
!added.has(importName)) {
|
|
374
|
+
added.add(importName);
|
|
375
|
+
types.push(`${specifier.isTypeOnly ? 'type ' : ''}${importName}`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
const names = [...kept, ...owners, ...types];
|
|
327
379
|
if (names.length === 0) {
|
|
328
380
|
edits.push(NamespaceTransform.removeImport({ sourceFile, declaration, clause, named, ts }));
|
|
329
381
|
continue;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every ARDOR hook under one name: `Ardor.useRepository(...)` is the same function as
|
|
3
|
+
* `useRepository`. Call a member by its name; do not index with a computed key (`Ardor[name]`), which
|
|
4
|
+
* keeps every hook in a bundle.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { Ardor, repository } from '@venizia/ardor';
|
|
9
|
+
*
|
|
10
|
+
* @repository()
|
|
11
|
+
* class OrdersRepository {
|
|
12
|
+
* count() { return 3; }
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* export const Orders = () => {
|
|
16
|
+
* const orders = Ardor.useRepository({ target: OrdersRepository });
|
|
17
|
+
* const container = Ardor.useApplicationContainer();
|
|
18
|
+
* return <span>{orders.count()} {container.isBound({ key: 'repositories.OrdersRepository' }) ? 'bound' : 'missing'}</span>;
|
|
19
|
+
* };
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
1
22
|
export * as Ardor from './ardor.js';
|
|
2
23
|
export * from '@venizia/ardor-kernel';
|
|
3
24
|
export * from '@venizia/ardor-react';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
// ARDOR - one entry point over the framework packages.
|
|
2
2
|
// An application imports from `@venizia/ardor`; a consumer that needs only one layer installs that
|
|
3
3
|
// package directly.
|
|
4
|
+
/**
|
|
5
|
+
* Every ARDOR hook under one name: `Ardor.useRepository(...)` is the same function as
|
|
6
|
+
* `useRepository`. Call a member by its name; do not index with a computed key (`Ardor[name]`), which
|
|
7
|
+
* keeps every hook in a bundle.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { Ardor, repository } from '@venizia/ardor';
|
|
12
|
+
*
|
|
13
|
+
* @repository()
|
|
14
|
+
* class OrdersRepository {
|
|
15
|
+
* count() { return 3; }
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* export const Orders = () => {
|
|
19
|
+
* const orders = Ardor.useRepository({ target: OrdersRepository });
|
|
20
|
+
* const container = Ardor.useApplicationContainer();
|
|
21
|
+
* return <span>{orders.count()} {container.isBound({ key: 'repositories.OrdersRepository' }) ? 'bound' : 'missing'}</span>;
|
|
22
|
+
* };
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
4
25
|
export * as Ardor from './ardor.js';
|
|
5
26
|
export * from '@venizia/ardor-kernel';
|
|
6
27
|
export * from '@venizia/ardor-react';
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@reduxjs/toolkit": "^2.13.0",
|
|
15
15
|
"@tanstack/react-query": "^5.104.5",
|
|
16
|
-
"@venizia/ardor": "0.4.8-
|
|
17
|
-
"@venizia/ignis-connectors": "0.4.8-
|
|
18
|
-
"@venizia/ignis-filter": "0.4.7-
|
|
19
|
-
"@venizia/ignis-helpers": "0.4.8-
|
|
20
|
-
"@venizia/ignis-inversion": "0.4.7-
|
|
21
|
-
"@venizia/ignis-kernel": "0.4.8-
|
|
16
|
+
"@venizia/ardor": "0.4.8-3",
|
|
17
|
+
"@venizia/ignis-connectors": "0.4.8-2",
|
|
18
|
+
"@venizia/ignis-filter": "0.4.7-2",
|
|
19
|
+
"@venizia/ignis-helpers": "0.4.8-2",
|
|
20
|
+
"@venizia/ignis-inversion": "0.4.7-2",
|
|
21
|
+
"@venizia/ignis-kernel": "0.4.8-2",
|
|
22
22
|
"class-variance-authority": "^0.7.1",
|
|
23
23
|
"clsx": "^2.1.1",
|
|
24
24
|
"ra-core": "^5.15.5",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@types/bun": "^1.4.3",
|
|
36
36
|
"@types/react": "^19",
|
|
37
37
|
"@types/react-dom": "^19",
|
|
38
|
-
"@venizia/dev-configs": "0.4.8-
|
|
39
|
-
"@venizia/ignis-boot": "0.4.8-
|
|
38
|
+
"@venizia/dev-configs": "0.4.8-2",
|
|
39
|
+
"@venizia/ignis-boot": "0.4.8-2",
|
|
40
40
|
"@vitejs/plugin-react": "^6.1.2",
|
|
41
41
|
"eslint": "^10.13.0",
|
|
42
42
|
"oxlint": "1.89.0",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
},
|
|
48
48
|
"peers": {
|
|
49
49
|
"@venizia/dev-configs": "^0.4.0 || ^0.4.8-0",
|
|
50
|
-
"@venizia/ignis-connectors": "^0.4.8-
|
|
51
|
-
"@venizia/ignis-filter": "^0.4.7-
|
|
52
|
-
"@venizia/ignis-helpers": "^0.4.8-
|
|
53
|
-
"@venizia/ignis-inversion": "^0.4.7-
|
|
54
|
-
"@venizia/ignis-kernel": "^0.4.8-
|
|
50
|
+
"@venizia/ignis-connectors": "^0.4.8-2",
|
|
51
|
+
"@venizia/ignis-filter": "^0.4.7-2",
|
|
52
|
+
"@venizia/ignis-helpers": "^0.4.8-2",
|
|
53
|
+
"@venizia/ignis-inversion": "^0.4.7-2",
|
|
54
|
+
"@venizia/ignis-kernel": "^0.4.8-2"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"server:dev": "vite --config .configs/builders/vite.config.mts",
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@types/bun": "^1.4.3",
|
|
7
7
|
"@types/react": "^19",
|
|
8
|
-
"@venizia/ardor": "^0.4.8-
|
|
9
|
-
"@venizia/dev-configs": "0.4.8-
|
|
10
|
-
"@venizia/ignis-boot": "0.4.8-
|
|
11
|
-
"@venizia/ignis-connectors": "0.4.8-
|
|
12
|
-
"@venizia/ignis-filter": "0.4.7-
|
|
13
|
-
"@venizia/ignis-helpers": "0.4.8-
|
|
14
|
-
"@venizia/ignis-inversion": "0.4.7-
|
|
15
|
-
"@venizia/ignis-kernel": "0.4.8-
|
|
8
|
+
"@venizia/ardor": "^0.4.8-3",
|
|
9
|
+
"@venizia/dev-configs": "0.4.8-2",
|
|
10
|
+
"@venizia/ignis-boot": "0.4.8-2",
|
|
11
|
+
"@venizia/ignis-connectors": "0.4.8-2",
|
|
12
|
+
"@venizia/ignis-filter": "0.4.7-2",
|
|
13
|
+
"@venizia/ignis-helpers": "0.4.8-2",
|
|
14
|
+
"@venizia/ignis-inversion": "0.4.7-2",
|
|
15
|
+
"@venizia/ignis-kernel": "0.4.8-2",
|
|
16
16
|
"eslint": "^10.13.0",
|
|
17
17
|
"oxlint": "1.89.0",
|
|
18
18
|
"oxlint-tsgolint": "7.0.2004",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"typescript": "^6.0.3"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@venizia/ardor": "^0.4.8-
|
|
26
|
+
"@venizia/ardor": "^0.4.8-3",
|
|
27
27
|
"react": "^19.3.1",
|
|
28
28
|
"react-dom": "^19.3.1",
|
|
29
29
|
"react-router-dom": "^7.18.4",
|
package/dist/testing.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as inversion from '@venizia/ignis-inversion';
|
|
|
2
2
|
import { type BaseArdorApplication } from '@venizia/ardor-kernel';
|
|
3
3
|
/** A class (matched exactly), a class name, or a binding key; the shape the shared core takes. */
|
|
4
4
|
export type TBootSkip = inversion.TBindingSkip;
|
|
5
|
+
/** What `assertArdorApplicationBoots` leaves out, which locale it loads, and when an empty application passes. */
|
|
5
6
|
export interface IAssertArdorApplicationBootsOptions {
|
|
6
7
|
/**
|
|
7
8
|
* Bindings the check leaves unresolved, for the few that open a socket or read the page when
|
|
@@ -16,8 +17,9 @@ export interface IAssertArdorApplicationBootsOptions {
|
|
|
16
17
|
/** The locale whose messages must load. Default: the i18n provider's initial one. */
|
|
17
18
|
locale?: string;
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* An application with no service, repository, datasource, component or configuration and no
|
|
21
|
+
* feature proves nothing (usually the artifact index was empty), so it fails unless this is `true`.
|
|
22
|
+
* @default false
|
|
21
23
|
*/
|
|
22
24
|
allowEmpty?: boolean;
|
|
23
25
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
/** The build info file's path when `fileName` is not set. */
|
|
1
2
|
export declare const DEFAULT_BUILD_INFO_FILE_NAME = "build-info.json";
|
|
3
|
+
/** The package-name prefix listed under `frameworks` when `frameworkScope` is not set. */
|
|
2
4
|
export declare const DEFAULT_FRAMEWORK_SCOPE = "@venizia/";
|
|
3
5
|
/** What to do when the commit is neither in the pipeline environment nor in git. */
|
|
4
6
|
export declare class UnresolvedPolicies {
|
|
7
|
+
/** The build fails. */
|
|
5
8
|
static readonly ERROR = "error";
|
|
9
|
+
/** The build goes on with the commit recorded as `unspecified`. */
|
|
6
10
|
static readonly UNSPECIFIED = "unspecified";
|
|
11
|
+
/** Every accepted policy value. */
|
|
7
12
|
static readonly SCHEME_SET: Set<string>;
|
|
13
|
+
/** Whether `value` is one of the policies. */
|
|
8
14
|
static isValid(value: string): boolean;
|
|
9
15
|
}
|
|
10
16
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
/** The build info file's path when `fileName` is not set. */
|
|
1
2
|
export const DEFAULT_BUILD_INFO_FILE_NAME = 'build-info.json';
|
|
3
|
+
/** The package-name prefix listed under `frameworks` when `frameworkScope` is not set. */
|
|
2
4
|
export const DEFAULT_FRAMEWORK_SCOPE = '@venizia/';
|
|
3
5
|
/** What to do when the commit is neither in the pipeline environment nor in git. */
|
|
4
6
|
export class UnresolvedPolicies {
|
|
7
|
+
/** The build fails. */
|
|
5
8
|
static { this.ERROR = 'error'; }
|
|
9
|
+
/** The build goes on with the commit recorded as `unspecified`. */
|
|
6
10
|
static { this.UNSPECIFIED = 'unspecified'; }
|
|
11
|
+
/** Every accepted policy value. */
|
|
7
12
|
static { this.SCHEME_SET = new Set([this.ERROR, this.UNSPECIFIED]); }
|
|
13
|
+
/** Whether `value` is one of the policies. */
|
|
8
14
|
static isValid(value) {
|
|
9
15
|
return this.SCHEME_SET.has(value);
|
|
10
16
|
}
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
import type { IBuildInfoFile, TConstValue } from '@venizia/ardor-kernel';
|
|
2
2
|
import type { TBuildInfoRecord } from '@venizia/ignis-helpers/core';
|
|
3
3
|
import type { UnresolvedPolicies } from './constants.js';
|
|
4
|
+
/** `'error'` or `'unspecified'`; see `UnresolvedPolicies`. */
|
|
4
5
|
export type TUnresolvedPolicy = TConstValue<typeof UnresolvedPolicies>;
|
|
6
|
+
/** The options of the `buildInfoFile` plugin. */
|
|
5
7
|
export interface IBuildInfoFileOptions {
|
|
6
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The app folder, where its package.json is.
|
|
10
|
+
* @default process.cwd()
|
|
11
|
+
*/
|
|
7
12
|
root?: string;
|
|
8
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The file's path under the output folder and under the dev server's base.
|
|
15
|
+
* A relative path of letters, digits, `.`, `_` and `-`, with `/` between folders, ending `.json`, and
|
|
16
|
+
* no `..` segment; anything else throws.
|
|
17
|
+
* @default 'build-info.json'
|
|
18
|
+
*/
|
|
9
19
|
fileName?: string;
|
|
10
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Dependencies whose name starts with this are listed under `frameworks`.
|
|
22
|
+
* @default '@venizia/'
|
|
23
|
+
*/
|
|
11
24
|
frameworkScope?: string;
|
|
12
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* What a build does when no commit can be found: `error` or `unspecified`. The dev server always serves what it has and warns.
|
|
27
|
+
* @default UnresolvedPolicies.ERROR
|
|
28
|
+
*/
|
|
13
29
|
onUnresolved?: TUnresolvedPolicy;
|
|
14
30
|
}
|
|
15
31
|
export type TGitReadResult = {
|
package/dist/vite/plugin.d.ts
CHANGED
|
@@ -15,6 +15,16 @@ export declare const createBuildInfoFilePlugin: (opts: {
|
|
|
15
15
|
* Emits `build-info.json` into the build and serves it on the dev server: the commit, the branch and
|
|
16
16
|
* the build time from the pipeline or git, the app's name and version, and the installed versions of
|
|
17
17
|
* the framework packages it depends on. The shape is `IBuildInfoFile` of `@venizia/ardor`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { buildInfoFile } from '@venizia/ardor/vite';
|
|
22
|
+
* import { defineConfig } from 'vite';
|
|
23
|
+
*
|
|
24
|
+
* export default defineConfig({
|
|
25
|
+
* plugins: [buildInfoFile({ fileName: 'build-info.json', onUnresolved: 'unspecified' })],
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
18
28
|
*/
|
|
19
29
|
export declare const buildInfoFile: (opts?: IBuildInfoFileOptions) => Plugin;
|
|
20
30
|
export {};
|
package/dist/vite/plugin.js
CHANGED
|
@@ -104,6 +104,16 @@ export const createBuildInfoFilePlugin = (opts) => {
|
|
|
104
104
|
* Emits `build-info.json` into the build and serves it on the dev server: the commit, the branch and
|
|
105
105
|
* the build time from the pipeline or git, the app's name and version, and the installed versions of
|
|
106
106
|
* the framework packages it depends on. The shape is `IBuildInfoFile` of `@venizia/ardor`.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import { buildInfoFile } from '@venizia/ardor/vite';
|
|
111
|
+
* import { defineConfig } from 'vite';
|
|
112
|
+
*
|
|
113
|
+
* export default defineConfig({
|
|
114
|
+
* plugins: [buildInfoFile({ fileName: 'build-info.json', onUnresolved: 'unspecified' })],
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
107
117
|
*/
|
|
108
118
|
export const buildInfoFile = (opts = {}) => createBuildInfoFilePlugin({ options: opts, sources: defaultSources });
|
|
109
119
|
//# sourceMappingURL=plugin.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ardor",
|
|
3
|
-
"version": "0.4.8-
|
|
3
|
+
"version": "0.4.8-3",
|
|
4
4
|
"description": "ARDOR - frontend application framework for the VENIZIA family. One entry point over ardor-kernel, ardor-react and ardor-admin: IGNIS inversion of control, a REST data layer, auth and i18n providers, and the React bindings for a react-admin application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ardor",
|
|
@@ -79,21 +79,21 @@
|
|
|
79
79
|
"prepublishOnly": "make rebuild"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@venizia/ardor-admin": "0.4.8-
|
|
83
|
-
"@venizia/ardor-kernel": "0.4.8-
|
|
84
|
-
"@venizia/ardor-react": "0.4.8-
|
|
82
|
+
"@venizia/ardor-admin": "0.4.8-3",
|
|
83
|
+
"@venizia/ardor-kernel": "0.4.8-3",
|
|
84
|
+
"@venizia/ardor-react": "0.4.8-3"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@size-limit/preset-small-lib": "^14.2.0",
|
|
88
88
|
"@types/bun": "^1.4.3",
|
|
89
89
|
"@types/node": "^25.0.10",
|
|
90
|
-
"@venizia/dev-configs": "^0.4.8-
|
|
91
|
-
"@venizia/ignis-boot": "^0.4.8-
|
|
92
|
-
"@venizia/ignis-connectors": "^0.4.8-
|
|
93
|
-
"@venizia/ignis-filter": "^0.4.7-
|
|
94
|
-
"@venizia/ignis-helpers": "^0.4.8-
|
|
95
|
-
"@venizia/ignis-inversion": "^0.4.7-
|
|
96
|
-
"@venizia/ignis-kernel": "^0.4.8-
|
|
90
|
+
"@venizia/dev-configs": "^0.4.8-2",
|
|
91
|
+
"@venizia/ignis-boot": "^0.4.8-2",
|
|
92
|
+
"@venizia/ignis-connectors": "^0.4.8-2",
|
|
93
|
+
"@venizia/ignis-filter": "^0.4.7-2",
|
|
94
|
+
"@venizia/ignis-helpers": "^0.4.8-2",
|
|
95
|
+
"@venizia/ignis-inversion": "^0.4.7-2",
|
|
96
|
+
"@venizia/ignis-kernel": "^0.4.8-2",
|
|
97
97
|
"eslint": "^10.13.0",
|
|
98
98
|
"oxlint": "1.89.0",
|
|
99
99
|
"oxlint-tsgolint": "7.0.2004",
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"@reduxjs/toolkit": ">=2.13.0",
|
|
107
107
|
"@tanstack/react-query": ">=5.104.5",
|
|
108
|
-
"@venizia/ignis-boot": "^0.4.8-
|
|
109
|
-
"@venizia/ignis-connectors": "^0.4.8-
|
|
110
|
-
"@venizia/ignis-filter": "^0.4.7-
|
|
111
|
-
"@venizia/ignis-helpers": "^0.4.8-
|
|
112
|
-
"@venizia/ignis-inversion": "^0.4.7-
|
|
113
|
-
"@venizia/ignis-kernel": "^0.4.8-
|
|
108
|
+
"@venizia/ignis-boot": "^0.4.8-2",
|
|
109
|
+
"@venizia/ignis-connectors": "^0.4.8-2",
|
|
110
|
+
"@venizia/ignis-filter": "^0.4.7-2",
|
|
111
|
+
"@venizia/ignis-helpers": "^0.4.8-2",
|
|
112
|
+
"@venizia/ignis-inversion": "^0.4.7-2",
|
|
113
|
+
"@venizia/ignis-kernel": "^0.4.8-2",
|
|
114
114
|
"ra-core": ">=5.15.5",
|
|
115
115
|
"ra-i18n-polyglot": ">=5.15.5",
|
|
116
116
|
"react": ">=19.3.1",
|