@djodjonx/neosyringe-plugin 0.0.4 → 0.0.6

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/dist/index.cjs CHANGED
@@ -130,6 +130,14 @@ const neoSyringePlugin = (0, unplugin.createUnplugin)(() => {
130
130
  const { options: compilerOptions } = typescript.parseJsonConfigFileContent(config, typescript.sys, process.cwd());
131
131
  if (code.includes("defineBuilderConfig")) {
132
132
  const graph = new _djodjonx_neosyringe_core_analyzer.Analyzer(typescript.createProgram([id], compilerOptions)).extract();
133
+ if (graph.errors && graph.errors.length > 0) {
134
+ const error = graph.errors[0];
135
+ const errorMessage = `[neosyringe-plugin] ${error.message}`;
136
+ const buildError = new Error(errorMessage);
137
+ buildError.name = error.type === "duplicate" ? "DuplicateRegistrationError" : "TypeMismatchError";
138
+ buildError.file = id;
139
+ throw buildError;
140
+ }
133
141
  if (graph.nodes.size > 0 && graph.defineBuilderConfigStart !== void 0 && graph.defineBuilderConfigEnd !== void 0 && graph.variableStatementStart !== void 0) {
134
142
  for (const tokenId of graph.nodes.keys()) registeredTokens.add(tokenId);
135
143
  new _djodjonx_neosyringe_core_generator.GraphValidator().validate(graph);
package/dist/index.mjs CHANGED
@@ -102,6 +102,14 @@ const neoSyringePlugin = createUnplugin(() => {
102
102
  const { options: compilerOptions } = ts.parseJsonConfigFileContent(config, ts.sys, process.cwd());
103
103
  if (code.includes("defineBuilderConfig")) {
104
104
  const graph = new Analyzer(ts.createProgram([id], compilerOptions)).extract();
105
+ if (graph.errors && graph.errors.length > 0) {
106
+ const error = graph.errors[0];
107
+ const errorMessage = `[neosyringe-plugin] ${error.message}`;
108
+ const buildError = new Error(errorMessage);
109
+ buildError.name = error.type === "duplicate" ? "DuplicateRegistrationError" : "TypeMismatchError";
110
+ buildError.file = id;
111
+ throw buildError;
112
+ }
105
113
  if (graph.nodes.size > 0 && graph.defineBuilderConfigStart !== void 0 && graph.defineBuilderConfigEnd !== void 0 && graph.variableStatementStart !== void 0) {
106
114
  for (const tokenId of graph.nodes.keys()) registeredTokens.add(tokenId);
107
115
  new GraphValidator().validate(graph);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djodjonx/neosyringe-plugin",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "NeoSyringe build plugin (Vite, Rollup, Webpack)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "unplugin": "^2.0.0",
25
- "@djodjonx/neosyringe-core": "1.0.0"
25
+ "@djodjonx/neosyringe-core": "1.2.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "typescript": ">=5.0.0"