@vaadin/hilla-generator-plugin-barrel 24.6.5 → 24.7.0-alpha11
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/BarrelProcessor.d.ts +1 -1
- package/BarrelProcessor.d.ts.map +1 -1
- package/BarrelProcessor.js +3 -3
- package/BarrelProcessor.js.map +2 -2
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/package.json +9 -27
package/BarrelProcessor.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type Plugin from '@vaadin/hilla-generator-core/Plugin.js';
|
|
|
2
2
|
import type { SourceFile } from 'typescript';
|
|
3
3
|
export default class BarrelProcessor {
|
|
4
4
|
#private;
|
|
5
|
-
static readonly BARREL_FILE_NAME = "endpoints
|
|
5
|
+
static readonly BARREL_FILE_NAME = "endpoints";
|
|
6
6
|
['constructor']: typeof BarrelProcessor;
|
|
7
7
|
constructor(endpoints: readonly SourceFile[], owner: Plugin);
|
|
8
8
|
process(): SourceFile;
|
package/BarrelProcessor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarrelProcessor.d.ts","sourceRoot":"","sources":["src/BarrelProcessor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,wCAAwC,CAAC;AAIjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,eAAe;;IAClC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"BarrelProcessor.d.ts","sourceRoot":"","sources":["src/BarrelProcessor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,wCAAwC,CAAC;AAIjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,eAAe;;IAClC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,eAAe;IACvC,CAAC,aAAa,CAAC,EAAE,OAAO,eAAe,CAAC;gBAKpC,SAAS,EAAE,SAAS,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM;IAK3D,OAAO,IAAI,UAAU;CAqBtB"}
|
package/BarrelProcessor.js
CHANGED
|
@@ -3,7 +3,7 @@ import createSourceFile from "@vaadin/hilla-generator-utils/createSourceFile.js"
|
|
|
3
3
|
import DependencyManager from "@vaadin/hilla-generator-utils/dependencies/DependencyManager.js";
|
|
4
4
|
import PathManager from "@vaadin/hilla-generator-utils/dependencies/PathManager.js";
|
|
5
5
|
class BarrelProcessor {
|
|
6
|
-
static BARREL_FILE_NAME = "endpoints
|
|
6
|
+
static BARREL_FILE_NAME = "endpoints";
|
|
7
7
|
#endpoints;
|
|
8
8
|
#outputPathManager = new PathManager({ extension: "ts" });
|
|
9
9
|
#owner;
|
|
@@ -12,7 +12,7 @@ class BarrelProcessor {
|
|
|
12
12
|
this.#owner = owner;
|
|
13
13
|
}
|
|
14
14
|
process() {
|
|
15
|
-
this.#owner.logger.debug(`Generating '${this.constructor.BARREL_FILE_NAME}' file`);
|
|
15
|
+
this.#owner.logger.debug(`Generating '${this.constructor.BARREL_FILE_NAME}.ts' file`);
|
|
16
16
|
const { exports, imports } = this.#endpoints.reduce(
|
|
17
17
|
(acc, { fileName }) => {
|
|
18
18
|
const specifier = basename(fileName, ".ts");
|
|
@@ -25,7 +25,7 @@ class BarrelProcessor {
|
|
|
25
25
|
);
|
|
26
26
|
return createSourceFile(
|
|
27
27
|
[...imports.toCode(), ...exports.toCode()],
|
|
28
|
-
this.#outputPathManager.createRelativePath(
|
|
28
|
+
this.#outputPathManager.createRelativePath(this.constructor.BARREL_FILE_NAME)
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
}
|
package/BarrelProcessor.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/BarrelProcessor.ts"],
|
|
4
|
-
"sourcesContent": ["import { basename, dirname } from 'path';\nimport type Plugin from '@vaadin/hilla-generator-core/Plugin.js';\nimport createSourceFile from '@vaadin/hilla-generator-utils/createSourceFile.js';\nimport DependencyManager from '@vaadin/hilla-generator-utils/dependencies/DependencyManager.js';\nimport PathManager from '@vaadin/hilla-generator-utils/dependencies/PathManager.js';\nimport type { SourceFile } from 'typescript';\n\nexport default class BarrelProcessor {\n static readonly BARREL_FILE_NAME = 'endpoints
|
|
5
|
-
"mappings": "AAAA,SAAS,UAAU,eAAe;AAElC,OAAO,sBAAsB;AAC7B,OAAO,uBAAuB;AAC9B,OAAO,iBAAiB;AAGxB,MAAO,gBAA8B;AAAA,EACnC,OAAgB,mBAAmB;AAAA,EAE1B;AAAA,EACA,qBAAqB,IAAI,YAAY,EAAE,WAAW,KAAK,CAAC;AAAA,EACxD;AAAA,EAET,YAAY,WAAkC,OAAe;AAC3D,SAAK,aAAa;AAClB,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,UAAsB;AACpB,SAAK,OAAO,OAAO,MAAM,eAAe,KAAK,YAAY,gBAAgB,
|
|
4
|
+
"sourcesContent": ["import { basename, dirname } from 'path';\nimport type Plugin from '@vaadin/hilla-generator-core/Plugin.js';\nimport createSourceFile from '@vaadin/hilla-generator-utils/createSourceFile.js';\nimport DependencyManager from '@vaadin/hilla-generator-utils/dependencies/DependencyManager.js';\nimport PathManager from '@vaadin/hilla-generator-utils/dependencies/PathManager.js';\nimport type { SourceFile } from 'typescript';\n\nexport default class BarrelProcessor {\n static readonly BARREL_FILE_NAME = 'endpoints';\n declare ['constructor']: typeof BarrelProcessor;\n readonly #endpoints: readonly SourceFile[];\n readonly #outputPathManager = new PathManager({ extension: 'ts' });\n readonly #owner: Plugin;\n\n constructor(endpoints: readonly SourceFile[], owner: Plugin) {\n this.#endpoints = endpoints;\n this.#owner = owner;\n }\n\n process(): SourceFile {\n this.#owner.logger.debug(`Generating '${this.constructor.BARREL_FILE_NAME}.ts' file`);\n\n const { exports, imports } = this.#endpoints.reduce(\n (acc, { fileName }) => {\n const specifier = basename(fileName, '.ts');\n const path = `${dirname(fileName)}/${specifier}`;\n\n const id = acc.imports.namespace.add(acc.paths.createRelativePath(path), specifier);\n acc.exports.named.add(specifier, false, id);\n\n return acc;\n },\n new DependencyManager(new PathManager({ extension: '.js' })),\n );\n\n return createSourceFile(\n [...imports.toCode(), ...exports.toCode()],\n this.#outputPathManager.createRelativePath(this.constructor.BARREL_FILE_NAME),\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,UAAU,eAAe;AAElC,OAAO,sBAAsB;AAC7B,OAAO,uBAAuB;AAC9B,OAAO,iBAAiB;AAGxB,MAAO,gBAA8B;AAAA,EACnC,OAAgB,mBAAmB;AAAA,EAE1B;AAAA,EACA,qBAAqB,IAAI,YAAY,EAAE,WAAW,KAAK,CAAC;AAAA,EACxD;AAAA,EAET,YAAY,WAAkC,OAAe;AAC3D,SAAK,aAAa;AAClB,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,UAAsB;AACpB,SAAK,OAAO,OAAO,MAAM,eAAe,KAAK,YAAY,gBAAgB,WAAW;AAEpF,UAAM,EAAE,SAAS,QAAQ,IAAI,KAAK,WAAW;AAAA,MAC3C,CAAC,KAAK,EAAE,SAAS,MAAM;AACrB,cAAM,YAAY,SAAS,UAAU,KAAK;AAC1C,cAAM,OAAO,GAAG,QAAQ,QAAQ,CAAC,IAAI,SAAS;AAE9C,cAAM,KAAK,IAAI,QAAQ,UAAU,IAAI,IAAI,MAAM,mBAAmB,IAAI,GAAG,SAAS;AAClF,YAAI,QAAQ,MAAM,IAAI,WAAW,OAAO,EAAE;AAE1C,eAAO;AAAA,MACT;AAAA,MACA,IAAI,kBAAkB,IAAI,YAAY,EAAE,WAAW,MAAM,CAAC,CAAC;AAAA,IAC7D;AAEA,WAAO;AAAA,MACL,CAAC,GAAG,QAAQ,OAAO,GAAG,GAAG,QAAQ,OAAO,CAAC;AAAA,MACzC,KAAK,mBAAmB,mBAAmB,KAAK,YAAY,gBAAgB;AAAA,IAC9E;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Plugin from '@vaadin/hilla-generator-core/Plugin.js';
|
|
2
|
-
import type SharedStorage from '@vaadin/hilla-generator-core/SharedStorage.js';
|
|
2
|
+
import type { SharedStorage } from '@vaadin/hilla-generator-core/SharedStorage.js';
|
|
3
3
|
export default class BarrelPlugin extends Plugin {
|
|
4
4
|
get path(): string;
|
|
5
5
|
execute({ pluginStorage, sources }: SharedStorage): Promise<void>;
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,wCAAwC,CAAC;AAC5D,OAAO,KAAK,aAAa,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,wCAAwC,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAMnF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM;IAC9C,IAAa,IAAI,IAAI,MAAM,CAE1B;IAGc,OAAO,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAWjF"}
|
package/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import Plugin from '@vaadin/hilla-generator-core/Plugin.js';\nimport type SharedStorage from '@vaadin/hilla-generator-core/SharedStorage.js';\nimport BackbonePlugin, { BackbonePluginSourceType } from '@vaadin/hilla-generator-plugin-backbone';\nimport PluginError from '@vaadin/hilla-generator-utils/PluginError.js';\nimport type { SourceFile } from 'typescript';\nimport BarrelProcessor from './BarrelProcessor.js';\n\nexport default class BarrelPlugin extends Plugin {\n override get path(): string {\n return import.meta.url;\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n override async execute({ pluginStorage, sources }: SharedStorage): Promise<void> {\n const tags = pluginStorage.get(BackbonePlugin.BACKBONE_PLUGIN_FILE_TAGS) as WeakMap<SourceFile, string> | undefined;\n\n if (!tags) {\n throw new PluginError(`${BackbonePlugin.name} should be run first.`, this.constructor.name);\n }\n\n const endpoints = sources.filter((file) => tags.get(file) === BackbonePluginSourceType.Endpoint);\n const barrelFile = new BarrelProcessor(endpoints, this).process();\n sources.push(barrelFile);\n }\n}\n"],
|
|
4
|
+
"sourcesContent": ["import Plugin from '@vaadin/hilla-generator-core/Plugin.js';\nimport type { SharedStorage } from '@vaadin/hilla-generator-core/SharedStorage.js';\nimport BackbonePlugin, { BackbonePluginSourceType } from '@vaadin/hilla-generator-plugin-backbone';\nimport PluginError from '@vaadin/hilla-generator-utils/PluginError.js';\nimport type { SourceFile } from 'typescript';\nimport BarrelProcessor from './BarrelProcessor.js';\n\nexport default class BarrelPlugin extends Plugin {\n override get path(): string {\n return import.meta.url;\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n override async execute({ pluginStorage, sources }: SharedStorage): Promise<void> {\n const tags = pluginStorage.get(BackbonePlugin.BACKBONE_PLUGIN_FILE_TAGS) as WeakMap<SourceFile, string> | undefined;\n\n if (!tags) {\n throw new PluginError(`${BackbonePlugin.name} should be run first.`, this.constructor.name);\n }\n\n const endpoints = sources.filter((file) => tags.get(file) === BackbonePluginSourceType.Endpoint);\n const barrelFile = new BarrelProcessor(endpoints, this).process();\n sources.push(barrelFile);\n }\n}\n"],
|
|
5
5
|
"mappings": "AAAA,OAAO,YAAY;AAEnB,OAAO,kBAAkB,gCAAgC;AACzD,OAAO,iBAAiB;AAExB,OAAO,qBAAqB;AAE5B,MAAO,qBAAmC,OAAO;AAAA,EAC/C,IAAa,OAAe;AAC1B,WAAO,YAAY;AAAA,EACrB;AAAA;AAAA,EAGA,MAAe,QAAQ,EAAE,eAAe,QAAQ,GAAiC;AAC/E,UAAM,OAAO,cAAc,IAAI,eAAe,yBAAyB;AAEvE,QAAI,CAAC,MAAM;AACT,YAAM,IAAI,YAAY,GAAG,eAAe,IAAI,yBAAyB,KAAK,YAAY,IAAI;AAAA,IAC5F;AAEA,UAAM,YAAY,QAAQ,OAAO,CAAC,SAAS,KAAK,IAAI,IAAI,MAAM,yBAAyB,QAAQ;AAC/F,UAAM,aAAa,IAAI,gBAAgB,WAAW,IAAI,EAAE,QAAQ;AAChE,YAAQ,KAAK,UAAU;AAAA,EACzB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/hilla-generator-plugin-barrel",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.7.0-alpha11",
|
|
4
4
|
"description": "A Hilla TypeScript Generator plugin to generate barrel file",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
"build:copy": "cd src && copyfiles **/*.d.ts ..",
|
|
16
16
|
"lint": "eslint src test",
|
|
17
17
|
"lint:fix": "eslint src test --fix",
|
|
18
|
-
"test": "
|
|
19
|
-
"test:
|
|
20
|
-
"test:
|
|
18
|
+
"test": "vitest --run",
|
|
19
|
+
"test:coverage": "vitest --run --coverage",
|
|
20
|
+
"test:update": "vitest --run --update",
|
|
21
|
+
"test:watch": "vitest",
|
|
21
22
|
"typecheck": "tsc --noEmit"
|
|
22
23
|
},
|
|
23
24
|
"exports": {
|
|
@@ -51,28 +52,9 @@
|
|
|
51
52
|
"access": "public"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@vaadin/hilla-generator-core": "24.
|
|
55
|
-
"@vaadin/hilla-generator-plugin-backbone": "24.
|
|
56
|
-
"@vaadin/hilla-generator-utils": "24.
|
|
57
|
-
"typescript": "5.7.
|
|
58
|
-
},
|
|
59
|
-
"devDependencies": {
|
|
60
|
-
"@types/chai": "^4.3.6",
|
|
61
|
-
"@types/mocha": "^10.0.2",
|
|
62
|
-
"@types/node": "^20.7.1",
|
|
63
|
-
"@types/sinon": "^10.0.17",
|
|
64
|
-
"@types/sinon-chai": "^3.2.10",
|
|
65
|
-
"@vaadin/hilla-generator-core": "24.6.5",
|
|
66
|
-
"@vaadin/hilla-generator-plugin-backbone": "24.6.5",
|
|
67
|
-
"c8": "^10.1.2",
|
|
68
|
-
"chai": "^4.3.10",
|
|
69
|
-
"concurrently": "^8.2.1",
|
|
70
|
-
"copyfiles": "^2.4.1",
|
|
71
|
-
"mocha": "^10.8.2",
|
|
72
|
-
"monocart-coverage-reports": "^2.11.5",
|
|
73
|
-
"pino": "^8.21.0",
|
|
74
|
-
"sinon": "^16.1.3",
|
|
75
|
-
"sinon-chai": "^3.7.0",
|
|
76
|
-
"type-fest": "^4.3.2"
|
|
55
|
+
"@vaadin/hilla-generator-core": "24.7.0-alpha11",
|
|
56
|
+
"@vaadin/hilla-generator-plugin-backbone": "24.7.0-alpha11",
|
|
57
|
+
"@vaadin/hilla-generator-utils": "24.7.0-alpha11",
|
|
58
|
+
"typescript": "5.7.3"
|
|
77
59
|
}
|
|
78
60
|
}
|