@vaadin/hilla-generator-plugin-barrel 24.7.0-alpha9 → 24.7.0-beta2

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.
@@ -1,10 +1,9 @@
1
- import type Plugin from '@vaadin/hilla-generator-core/Plugin.js';
2
- import type { SourceFile } from 'typescript';
1
+ import type Plugin from "@vaadin/hilla-generator-core/Plugin.js";
2
+ import type { SourceFile } from "typescript";
3
3
  export default class BarrelProcessor {
4
- #private;
5
- static readonly BARREL_FILE_NAME = "endpoints.ts";
6
- ['constructor']: typeof BarrelProcessor;
7
- constructor(endpoints: readonly SourceFile[], owner: Plugin);
8
- process(): SourceFile;
4
+ #private;
5
+ static readonly BARREL_FILE_NAME = "endpoints";
6
+ ["constructor"]: typeof BarrelProcessor;
7
+ constructor(endpoints: readonly SourceFile[], owner: Plugin);
8
+ process(): SourceFile;
9
9
  }
10
- //# sourceMappingURL=BarrelProcessor.d.ts.map
@@ -2,34 +2,25 @@ import { basename, dirname } from "path";
2
2
  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
- class BarrelProcessor {
6
- static BARREL_FILE_NAME = "endpoints.ts";
7
- #endpoints;
8
- #outputPathManager = new PathManager({ extension: "ts" });
9
- #owner;
10
- constructor(endpoints, owner) {
11
- this.#endpoints = endpoints;
12
- this.#owner = owner;
13
- }
14
- process() {
15
- this.#owner.logger.debug(`Generating '${this.constructor.BARREL_FILE_NAME}' file`);
16
- const { exports, imports } = this.#endpoints.reduce(
17
- (acc, { fileName }) => {
18
- const specifier = basename(fileName, ".ts");
19
- const path = `${dirname(fileName)}/${specifier}`;
20
- const id = acc.imports.namespace.add(acc.paths.createRelativePath(path), specifier);
21
- acc.exports.named.add(specifier, false, id);
22
- return acc;
23
- },
24
- new DependencyManager(new PathManager({ extension: ".js" }))
25
- );
26
- return createSourceFile(
27
- [...imports.toCode(), ...exports.toCode()],
28
- this.#outputPathManager.createRelativePath("endpoints")
29
- );
30
- }
5
+ export default class BarrelProcessor {
6
+ static BARREL_FILE_NAME = "endpoints";
7
+ #endpoints;
8
+ #outputPathManager = new PathManager({ extension: "ts" });
9
+ #owner;
10
+ constructor(endpoints, owner) {
11
+ this.#endpoints = endpoints;
12
+ this.#owner = owner;
13
+ }
14
+ process() {
15
+ this.#owner.logger.debug(`Generating '${this.constructor.BARREL_FILE_NAME}.ts' file`);
16
+ const { exports, imports } = this.#endpoints.reduce((acc, { fileName }) => {
17
+ const specifier = basename(fileName, ".ts");
18
+ const path = `${dirname(fileName)}/${specifier}`;
19
+ const id = acc.imports.namespace.add(acc.paths.createRelativePath(path), specifier);
20
+ acc.exports.named.add(specifier, false, id);
21
+ return acc;
22
+ }, new DependencyManager(new PathManager({ extension: ".js" })));
23
+ return createSourceFile([...imports.toCode(), ...exports.toCode()], this.#outputPathManager.createRelativePath(this.constructor.BARREL_FILE_NAME));
24
+ }
31
25
  }
32
- export {
33
- BarrelProcessor as default
34
- };
35
- //# sourceMappingURL=BarrelProcessor.js.map
26
+ //# sourceMappingURL=./BarrelProcessor.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 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.ts';\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}' 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('endpoints'),\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,QAAQ;AAEjF,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,WAAW;AAAA,IACxD;AAAA,EACF;AACF;",
6
- "names": []
7
- }
1
+ {"mappings":"AAAA,SAAS,UAAU,qBAAsB;AAEzC,OAAO,yEAA0E;AACjF,OAAO,wFAAyF;AAChG,OAAO,4EAA6E;AAGpF,eAAe,MAAM,gBAAgB;CACnC,OAAgB,mBAAmB;CAEnC,AAASA;CACT,AAASC,qBAAqB,IAAI,YAAY,EAAE,WAAW,KAAM;CACjE,AAASC;CAET,YAAYC,WAAkCC,OAAe;AAC3D,OAAKJ,aAAa;AAClB,OAAKE,SAAS;CACf;CAED,UAAsB;AACpB,OAAKA,OAAO,OAAO,OAAO,cAAc,KAAK,YAAY,iBAAiB,WAAW;EAErF,MAAM,EAAE,SAAS,SAAS,GAAG,KAAKF,WAAW,OAC3C,CAAC,KAAK,EAAE,UAAU,KAAK;GACrB,MAAM,YAAY,SAAS,UAAU,MAAM;GAC3C,MAAM,QAAQ,EAAE,QAAQ,SAAS,CAAC,GAAG,UAAU;GAE/C,MAAM,KAAK,IAAI,QAAQ,UAAU,IAAI,IAAI,MAAM,mBAAmB,KAAK,EAAE,UAAU;AACnF,OAAI,QAAQ,MAAM,IAAI,WAAW,OAAO,GAAG;AAE3C,UAAO;EACR,GACD,IAAI,kBAAkB,IAAI,YAAY,EAAE,WAAW,MAAO,IAC3D;AAED,SAAO,iBACL,CAAC,GAAG,QAAQ,QAAQ,EAAE,GAAG,QAAQ,QAAQ,AAAC,GAC1C,KAAKC,mBAAmB,mBAAmB,KAAK,YAAY,iBAAiB,CAC9E;CACF;AACF","names":["#endpoints","#outputPathManager","#owner","endpoints: readonly SourceFile[]","owner: Plugin"],"sources":["/opt/agent/work/1af72d8adc613024/hilla/packages/ts/generator-plugin-barrel/src/BarrelProcessor.ts"],"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"],"version":3}
package/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import Plugin from '@vaadin/hilla-generator-core/Plugin.js';
2
- import type SharedStorage from '@vaadin/hilla-generator-core/SharedStorage.js';
1
+ import Plugin from "@vaadin/hilla-generator-core/Plugin.js";
2
+ import type { SharedStorage } from "@vaadin/hilla-generator-core/SharedStorage.js";
3
3
  export default class BarrelPlugin extends Plugin {
4
- get path(): string;
5
- execute({ pluginStorage, sources }: SharedStorage): Promise<void>;
4
+ get path(): string;
5
+ execute({ pluginStorage, sources }: SharedStorage): Promise<void>;
6
6
  }
7
- //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -2,22 +2,18 @@ import Plugin from "@vaadin/hilla-generator-core/Plugin.js";
2
2
  import BackbonePlugin, { BackbonePluginSourceType } from "@vaadin/hilla-generator-plugin-backbone";
3
3
  import PluginError from "@vaadin/hilla-generator-utils/PluginError.js";
4
4
  import BarrelProcessor from "./BarrelProcessor.js";
5
- class BarrelPlugin extends Plugin {
6
- get path() {
7
- return import.meta.url;
8
- }
9
- // eslint-disable-next-line @typescript-eslint/require-await
10
- async execute({ pluginStorage, sources }) {
11
- const tags = pluginStorage.get(BackbonePlugin.BACKBONE_PLUGIN_FILE_TAGS);
12
- if (!tags) {
13
- throw new PluginError(`${BackbonePlugin.name} should be run first.`, this.constructor.name);
14
- }
15
- const endpoints = sources.filter((file) => tags.get(file) === BackbonePluginSourceType.Endpoint);
16
- const barrelFile = new BarrelProcessor(endpoints, this).process();
17
- sources.push(barrelFile);
18
- }
5
+ export default class BarrelPlugin extends Plugin {
6
+ get path() {
7
+ return import.meta.url;
8
+ }
9
+ async execute({ pluginStorage, sources }) {
10
+ const tags = pluginStorage.get(BackbonePlugin.BACKBONE_PLUGIN_FILE_TAGS);
11
+ if (!tags) {
12
+ throw new PluginError(`${BackbonePlugin.name} should be run first.`, this.constructor.name);
13
+ }
14
+ const endpoints = sources.filter((file) => tags.get(file) === BackbonePluginSourceType.Endpoint);
15
+ const barrelFile = new BarrelProcessor(endpoints, this).process();
16
+ sources.push(barrelFile);
17
+ }
19
18
  }
20
- export {
21
- BarrelPlugin as default
22
- };
23
- //# sourceMappingURL=index.js.map
19
+ //# sourceMappingURL=./index.js.map
package/index.js.map CHANGED
@@ -1,7 +1 @@
1
- {
2
- "version": 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"],
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
- "names": []
7
- }
1
+ {"mappings":"AAAA,OAAO,oDAAqD;AAE5D,OAAO,kBAAkB,yEAA0E;AACnG,OAAO,+DAAgE;AAEvE,OAAO,2CAA4C;AAEnD,eAAe,MAAM,qBAAqB,OAAO;CAC/C,IAAa,OAAe;AAC1B,SAAO,OAAO,KAAK;CACpB;CAGD,MAAe,QAAQ,EAAE,eAAe,SAAwB,EAAiB;EAC/E,MAAM,OAAO,cAAc,IAAI,eAAe,0BAA0B;AAExE,OAAK,MAAM;AACT,SAAM,IAAI,aAAa,EAAE,eAAe,KAAK,wBAAwB,KAAK,YAAY;EACvF;EAED,MAAM,YAAY,QAAQ,OAAO,CAAC,SAAS,KAAK,IAAI,KAAK,KAAK,yBAAyB,SAAS;EAChG,MAAM,aAAa,IAAI,gBAAgB,WAAW,MAAM,SAAS;AACjE,UAAQ,KAAK,WAAW;CACzB;AACF","names":[],"sources":["/opt/agent/work/1af72d8adc613024/hilla/packages/ts/generator-plugin-barrel/src/index.ts"],"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"],"version":3}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/hilla-generator-plugin-barrel",
3
- "version": "24.7.0-alpha9",
3
+ "version": "24.7.0-beta2",
4
4
  "description": "A Hilla TypeScript Generator plugin to generate barrel file",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -9,15 +9,13 @@
9
9
  },
10
10
  "scripts": {
11
11
  "clean:build": "git clean -fx . -e .vite -e node_modules",
12
- "build": "concurrently npm:build:*",
13
- "build:esbuild": "tsx ../../../scripts/build.ts",
14
- "build:dts": "tsc --isolatedModules -p tsconfig.build.json",
15
- "build:copy": "cd src && copyfiles **/*.d.ts ..",
12
+ "build": "tsx ../../../scripts/fast-build.ts",
16
13
  "lint": "eslint src test",
17
14
  "lint:fix": "eslint src test --fix",
18
- "test": "mocha test/**/*.spec.ts --config ../../../.mocharc.cjs",
19
- "test:update": "npm test -- --update",
20
- "test:coverage": "c8 --experimental-monocart -c ../../../.c8rc.json npm test",
15
+ "test": "vitest --run",
16
+ "test:coverage": "vitest --run --coverage",
17
+ "test:update": "vitest --run --update",
18
+ "test:watch": "vitest",
21
19
  "typecheck": "tsc --noEmit"
22
20
  },
23
21
  "exports": {
@@ -51,28 +49,9 @@
51
49
  "access": "public"
52
50
  },
53
51
  "dependencies": {
54
- "@vaadin/hilla-generator-core": "24.7.0-alpha9",
55
- "@vaadin/hilla-generator-plugin-backbone": "24.7.0-alpha9",
56
- "@vaadin/hilla-generator-utils": "24.7.0-alpha9",
52
+ "@vaadin/hilla-generator-core": "24.7.0-beta2",
53
+ "@vaadin/hilla-generator-plugin-backbone": "24.7.0-beta2",
54
+ "@vaadin/hilla-generator-utils": "24.7.0-beta2",
57
55
  "typescript": "5.7.3"
58
- },
59
- "devDependencies": {
60
- "@types/chai": "^4.3.20",
61
- "@types/mocha": "^10.0.10",
62
- "@types/node": "^20.17.12",
63
- "@types/sinon": "^10.0.20",
64
- "@types/sinon-chai": "^3.2.12",
65
- "@vaadin/hilla-generator-core": "24.7.0-alpha9",
66
- "@vaadin/hilla-generator-plugin-backbone": "24.7.0-alpha9",
67
- "c8": "^10.1.3",
68
- "chai": "^4.5.0",
69
- "concurrently": "^9.1.2",
70
- "copyfiles": "^2.4.1",
71
- "mocha": "^11.1.0",
72
- "monocart-coverage-reports": "^2.11.5",
73
- "pino": "^9.6.0",
74
- "sinon": "^16.1.3",
75
- "sinon-chai": "^3.7.0",
76
- "type-fest": "^4.32.0"
77
56
  }
78
57
  }
@@ -1 +0,0 @@
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,kBAAkB;IAC1C,CAAC,aAAa,CAAC,EAAE,OAAO,eAAe,CAAC;gBAKpC,SAAS,EAAE,SAAS,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM;IAK3D,OAAO,IAAI,UAAU;CAqBtB"}
package/index.d.ts.map DELETED
@@ -1 +0,0 @@
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;AAM/E,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"}