@uniflowed/vite 0.0.0-alpha.4 → 0.0.0-alpha.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/internal/config.js +9 -3
- package/package.json +2 -2
package/internal/config.js
CHANGED
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
// data and cannot use the functions.
|
|
18
18
|
|
|
19
19
|
import { createHash } from "node:crypto";
|
|
20
|
-
import {
|
|
20
|
+
import { readFileSync } from "node:fs";
|
|
21
21
|
import path from "node:path";
|
|
22
22
|
import { pathToFileURL } from "node:url";
|
|
23
23
|
|
|
24
24
|
import { transformFlow } from "@uniflowed/host/transform";
|
|
25
|
+
import { writeAtomically } from "@uniflowed/host/write-atomically";
|
|
25
26
|
|
|
26
27
|
/** The one config file name uf reads. */
|
|
27
28
|
export const CONFIG_FILES = ["uf.config.js"];
|
|
@@ -94,8 +95,13 @@ async function compileConfig(source, file, root) {
|
|
|
94
95
|
|
|
95
96
|
const out = await transformFlow(source, file, { root, sourceMap: false });
|
|
96
97
|
const code = rewriteRelativeImports(out?.code ?? source, path.dirname(file));
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
// Atomically, because two `uf` commands in one project write this same path
|
|
99
|
+
// at the same time — the hash is of the source, so they agree on the name —
|
|
100
|
+
// and `writeFileSync` truncates before it writes. A reader that caught it
|
|
101
|
+
// mid-write imported a module with no exports and reported it as
|
|
102
|
+
// `uf.config.js must export default defineConfig({ ... })`, which is a
|
|
103
|
+
// sentence about a file that is perfectly correct. See ubugeeei-prod/uf#240.
|
|
104
|
+
writeAtomically(target, `// Compiled from ${file}. Do not edit; edit the source.\n${code}`);
|
|
99
105
|
return target;
|
|
100
106
|
}
|
|
101
107
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniflowed/vite",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.6",
|
|
4
4
|
"description": "Vite, driven by uf.config.js: every Flow module through `uf transform`, MDX, the file-system router and static rendering as Vite plugins.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@mdx-js/rollup": "^3.1.1",
|
|
27
27
|
"@shikijs/rehype": "^3.23.0",
|
|
28
|
-
"@uniflowed/host": "0.0.0-alpha.
|
|
28
|
+
"@uniflowed/host": "0.0.0-alpha.6",
|
|
29
29
|
"rehype-slug": "^6.0.0",
|
|
30
30
|
"remark-frontmatter": "^5.0.0",
|
|
31
31
|
"remark-gfm": "^4.0.1",
|