@analogjs/vite-plugin-angular 3.0.0-alpha.53 → 3.0.0-alpha.55

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@analogjs/vite-plugin-angular",
3
- "version": "3.0.0-alpha.53",
3
+ "version": "3.0.0-alpha.55",
4
4
  "description": "Vite Plugin for Angular",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -740,9 +740,10 @@ function angular(options) {
740
740
  data = patched;
741
741
  }
742
742
  }
743
+ if (typescriptResult.map) data = data.replace(/\s*\/\/# sourceMappingURL=[^\r\n]*\s*$/, "");
743
744
  return {
744
745
  code: data,
745
- map: null
746
+ map: typescriptResult.map ?? null
746
747
  };
747
748
  }
748
749
  },
@@ -800,7 +801,7 @@ function angular(options) {
800
801
  classNames,
801
802
  fileEmitter
802
803
  }),
803
- ...isTest && !isStackBlitz ? angularVitestPlugins() : [],
804
+ ...isTest && !isStackBlitz ? angularVitestPlugins((id) => outputFiles.get(normalizePath(id))?.map) : [],
804
805
  jit && jitPlugin({ inlineStylesExtension: pluginOptions.inlineStylesExtension }),
805
806
  buildOptimizerPlugin({
806
807
  supportedBrowsers: pluginOptions.supportedBrowsers,
@@ -921,9 +922,19 @@ function angular(options) {
921
922
  const writeFileCallback = (_filename, content, _a, _b, sourceFiles) => {
922
923
  if (!sourceFiles?.length) return;
923
924
  const filename = normalizePath(sourceFiles[0].fileName);
924
- if (filename.includes("ngtypecheck.ts") || filename.includes(".d.")) return;
925
+ if (filename.includes("ngtypecheck.ts") || filename.includes(".d.") || _filename.endsWith(".d.ts") || _filename.endsWith(".d.mts") || _filename.endsWith(".d.cts")) return;
926
+ if (/\.[cm]?js\.map$/.test(_filename)) {
927
+ const existing = outputFiles.get(filename);
928
+ outputFiles.set(filename, {
929
+ ...existing ?? { dependencies: [] },
930
+ map: content
931
+ });
932
+ return;
933
+ }
925
934
  const metadata = watchMode ? fileMetadata(filename) : {};
935
+ const existing = outputFiles.get(filename);
926
936
  outputFiles.set(filename, {
937
+ ...existing ?? {},
927
938
  content,
928
939
  dependencies: [],
929
940
  errors: metadata.errors,
@@ -944,8 +955,14 @@ function angular(options) {
944
955
  const sourceFile = builder.getSourceFile(id);
945
956
  if (!sourceFile) return;
946
957
  let content = "";
958
+ let map;
959
+ let mapFilename;
947
960
  builder.emit(sourceFile, (filename, data) => {
948
961
  if (/\.[cm]?js$/.test(filename)) content = data;
962
+ if (/\.[cm]?js\.map$/.test(filename)) {
963
+ map = data;
964
+ mapFilename = filename;
965
+ }
949
966
  if (!watchMode && !isTest && /\.d\.ts/.test(filename) && !filename.includes(".ngtypecheck.")) {
950
967
  const declarationPath = resolve(config.root, config.build.outDir, relative(config.root, filename)).replace("/src/", "/");
951
968
  const declarationFileDir = declarationPath.replace(basename(filename), "").replace("/src/", "/");
@@ -957,6 +974,7 @@ function angular(options) {
957
974
  }
958
975
  }, void 0, void 0, transformers);
959
976
  writeFileCallback(id, content, false, void 0, [sourceFile]);
977
+ if (map !== void 0 && mapFilename !== void 0) writeFileCallback(mapFilename, map, false, void 0, [sourceFile]);
960
978
  if (angularCompiler) angularCompiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);
961
979
  };
962
980
  if (watchMode) {