svelte-ag 1.0.15 → 1.0.16

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 +1 @@
1
- {"version":3,"file":"vite-plugin-component-source-collector.d.ts","sourceRoot":"","sources":["../../../src/lib/vite/vite-plugin-component-source-collector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAKnD,UAAU,OAAO;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE5B,GAAG,EAAE,OAAO,CAAC;IAEb;;OAEG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAKD,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,IAAI,GAAE,OAAyC,GAAG,MAAM,CAyHxG"}
1
+ {"version":3,"file":"vite-plugin-component-source-collector.d.ts","sourceRoot":"","sources":["../../../src/lib/vite/vite-plugin-component-source-collector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAKnD,UAAU,OAAO;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE5B,GAAG,EAAE,OAAO,CAAC;IAEb;;OAEG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAKD,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,IAAI,GAAE,OAAyC,GAAG,MAAM,CA2HxG"}
@@ -1,4 +1,4 @@
1
- import { writeIfDifferent } from 'ts-ag';
1
+ import { exists, writeIfDifferent } from 'ts-ag';
2
2
  import path from 'path';
3
3
  import { readFile } from 'fs/promises';
4
4
  /** All unique component directories */
@@ -53,9 +53,11 @@ export default function componentSourceCollector(opts = { run: true, safePackage
53
53
  firstRound = false;
54
54
  }
55
55
  else if (config.command === 'serve') {
56
- const fileLines = (await readFile(outPath, 'utf8')).split('\n');
57
- fileLines.forEach((l) => addPath(l.replace(/@source\s+'(.*?)';/, '$1')));
58
- console.log('config resolved', componentFiles);
56
+ if (await exists(outPath)) {
57
+ const fileLines = (await readFile(outPath, 'utf8')).split('\n');
58
+ fileLines.forEach((l) => addPath(l.replace(/@source\s+'(.*?)';/, '$1')));
59
+ console.log('config resolved', componentFiles);
60
+ }
59
61
  }
60
62
  console.log('tailwind-sources:configResolved:command', config.command);
61
63
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-ag",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Useful svelte components",
5
5
  "bugs": "https://github.com/ageorgeh/svelte-ag/issues",
6
6
  "repository": {
@@ -1,5 +1,5 @@
1
1
  import type { Plugin, ResolvedConfig } from 'vite';
2
- import { writeIfDifferent } from 'ts-ag';
2
+ import { exists, writeIfDifferent } from 'ts-ag';
3
3
  import path from 'path';
4
4
  import { readFile } from 'fs/promises';
5
5
 
@@ -85,9 +85,11 @@ export default function componentSourceCollector(opts: Options = { run: true, sa
85
85
  componentFiles.clear();
86
86
  firstRound = false;
87
87
  } else if (config.command === 'serve') {
88
- const fileLines = (await readFile(outPath, 'utf8')).split('\n');
89
- fileLines.forEach((l) => addPath(l.replace(/@source\s+'(.*?)';/, '$1')));
90
- console.log('config resolved', componentFiles);
88
+ if (await exists(outPath)) {
89
+ const fileLines = (await readFile(outPath, 'utf8')).split('\n');
90
+ fileLines.forEach((l) => addPath(l.replace(/@source\s+'(.*?)';/, '$1')));
91
+ console.log('config resolved', componentFiles);
92
+ }
91
93
  }
92
94
  console.log('tailwind-sources:configResolved:command', config.command);
93
95
  },