@danielx/civet 0.7.11 → 0.7.13
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/astro.js +10 -0
- package/dist/browser.js +151 -106
- package/dist/bun-civet.mjs +5 -6
- package/dist/esbuild.js +10 -0
- package/dist/main.js +151 -106
- package/dist/main.mjs +151 -106
- package/dist/rollup.js +10 -0
- package/dist/unplugin-shared.mjs +10 -0
- package/dist/unplugin.d.mts +2 -0
- package/dist/unplugin.d.ts +2 -0
- package/dist/unplugin.js +10 -0
- package/dist/vite.js +10 -0
- package/dist/webpack.js +10 -0
- package/package.json +6 -20
package/dist/bun-civet.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { plugin } from "bun";
|
|
1
|
+
import { plugin, file } from "bun";
|
|
2
2
|
await plugin({
|
|
3
3
|
name: "Civet loader",
|
|
4
|
-
|
|
4
|
+
async setup(builder) {
|
|
5
5
|
const { compile } = await import("./main.mjs");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const contents = await compile(source, { comptime: true });
|
|
6
|
+
return builder.onLoad({ filter: /\.civet$/ }, async ({ path }) => {
|
|
7
|
+
const source = await file(path).text();
|
|
8
|
+
let contents = await compile(source, { comptime: true });
|
|
10
9
|
return {
|
|
11
10
|
contents,
|
|
12
11
|
loader: "tsx"
|
package/dist/esbuild.js
CHANGED
|
@@ -108,6 +108,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
108
108
|
getCanonicalFileName: sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase()
|
|
109
109
|
};
|
|
110
110
|
};
|
|
111
|
+
const cache = options.cache ? /* @__PURE__ */ new Map() : void 0;
|
|
111
112
|
return {
|
|
112
113
|
name: "unplugin-civet",
|
|
113
114
|
enforce: "pre",
|
|
@@ -320,6 +321,14 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
320
321
|
return null;
|
|
321
322
|
const basename = id.slice(0, match.index + match[1].length);
|
|
322
323
|
const filename = import_path.default.resolve(rootDir, basename);
|
|
324
|
+
let mtime;
|
|
325
|
+
if (cache) {
|
|
326
|
+
mtime = (await fs.promises.stat(filename)).mtimeMs;
|
|
327
|
+
const cached = cache?.get(filename);
|
|
328
|
+
if (cached && cached.mtime === mtime) {
|
|
329
|
+
return cached.result;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
323
332
|
const rawCivetSource = await fs.promises.readFile(filename, "utf-8");
|
|
324
333
|
this.addWatchFile(filename);
|
|
325
334
|
let compiled;
|
|
@@ -403,6 +412,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
403
412
|
};
|
|
404
413
|
if (options.transformOutput)
|
|
405
414
|
transformed = await options.transformOutput(transformed.code, id);
|
|
415
|
+
cache?.set(filename, { mtime, result: transformed });
|
|
406
416
|
return transformed;
|
|
407
417
|
},
|
|
408
418
|
esbuild: {
|