@danielx/civet 0.7.10 → 0.7.12
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/README.md +2 -3
- package/dist/astro.js +10 -0
- package/dist/browser.js +302 -227
- package/dist/civet +19 -14
- package/dist/esbuild.js +10 -0
- package/dist/esm.mjs +0 -31
- package/dist/main.js +302 -227
- package/dist/main.mjs +302 -227
- 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 +2 -2
- package/register.js +40 -12
package/README.md
CHANGED
|
@@ -240,8 +240,6 @@ to set up your environment to get productive right away and have a Good Time℠.
|
|
|
240
240
|
Code coverage with [c8](https://github.com/bcoe/c8) "just works" thanks to their source map
|
|
241
241
|
integration and Civet's source maps.
|
|
242
242
|
|
|
243
|
-
Currently Civet's ESM loader depends on [ts-node](https://www.npmjs.com/package/ts-node)
|
|
244
|
-
|
|
245
243
|
#### c8 + Mocha
|
|
246
244
|
|
|
247
245
|
`package.json`
|
|
@@ -260,13 +258,13 @@ Currently Civet's ESM loader depends on [ts-node](https://www.npmjs.com/package/
|
|
|
260
258
|
"civet"
|
|
261
259
|
],
|
|
262
260
|
"loader": [
|
|
263
|
-
"ts-node/esm",
|
|
264
261
|
"@danielx/civet/esm"
|
|
265
262
|
],
|
|
266
263
|
...
|
|
267
264
|
...
|
|
268
265
|
```
|
|
269
266
|
|
|
267
|
+
<!--
|
|
270
268
|
`ts-node` must be configured with `transpileOnly` (it can't resolve alternative extensions). Also I think `module` needs to be at least `ES2020` for the Civet ESM loader to work.
|
|
271
269
|
|
|
272
270
|
`tsconfig.json`
|
|
@@ -279,6 +277,7 @@ Currently Civet's ESM loader depends on [ts-node](https://www.npmjs.com/package/
|
|
|
279
277
|
}
|
|
280
278
|
}
|
|
281
279
|
```
|
|
280
|
+
-->
|
|
282
281
|
|
|
283
282
|
If you don't care for code coverage you can skip c8 (but it is so easy why not keep it?).
|
|
284
283
|
|
package/dist/astro.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: {
|