svelte-reflector 1.3.0 → 1.3.1
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/file.js +4 -1
- package/package.json +1 -1
package/dist/file.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { writeFileSync } from "node:fs";
|
|
1
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
2
3
|
import prettier from "prettier";
|
|
3
4
|
export class Source {
|
|
4
5
|
path;
|
|
@@ -9,11 +10,13 @@ export class Source {
|
|
|
9
10
|
this.data = data ?? "";
|
|
10
11
|
}
|
|
11
12
|
async save() {
|
|
13
|
+
mkdirSync(dirname(this.path), { recursive: true });
|
|
12
14
|
const options = await prettier.resolveConfig(process.cwd());
|
|
13
15
|
const formatted = await prettier.format(this.data, { ...options, filepath: this.path });
|
|
14
16
|
writeFileSync(this.path, formatted, "utf8");
|
|
15
17
|
}
|
|
16
18
|
async safeSave() {
|
|
19
|
+
mkdirSync(dirname(this.path), { recursive: true });
|
|
17
20
|
writeFileSync(this.path, this.data, "utf8");
|
|
18
21
|
}
|
|
19
22
|
changeData(data) {
|