@gjsify/rolldown-plugin-deepkit 0.43.0 → 0.44.0
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/lib/index.d.ts +13 -0
- package/lib/index.js +16 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -2,5 +2,18 @@ import type { Plugin } from 'rolldown';
|
|
|
2
2
|
export interface DeepkitPluginOptions {
|
|
3
3
|
reflection?: boolean;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Whether `id` is inside the set this plugin reflects — the same `FILTER` the
|
|
7
|
+
* `transform` hook tests at runtime, not a second copy of the regex.
|
|
8
|
+
*
|
|
9
|
+
* Exists because that filter is also a load-bearing DEPENDENCY of anything that
|
|
10
|
+
* mints a virtual module id meant to be reflected: `@gjsify/rolldown-plugin-vue`
|
|
11
|
+
* appends a `.gjsify-vue.ts` tail to route `.vue` SFCs through TypeScript parsing,
|
|
12
|
+
* and the same tail is what makes deepkit see the id at all (`status/open-todos.md`
|
|
13
|
+
* § "The Vue plugin's virtual suffix is coupled to deepkit's filter"). A silent
|
|
14
|
+
* drift here switches reflection off for every consumer with no diagnostic — the
|
|
15
|
+
* build still exits 0.
|
|
16
|
+
*/
|
|
17
|
+
export declare function reflectsModuleId(id: string): boolean;
|
|
5
18
|
export declare function deepkitPlugin(options?: DeepkitPluginOptions): Plugin;
|
|
6
19
|
export default deepkitPlugin;
|
package/lib/index.js
CHANGED
|
@@ -21,6 +21,21 @@ async function getLoader() {
|
|
|
21
21
|
return cachedLoader;
|
|
22
22
|
}
|
|
23
23
|
const FILTER = /\.(m|c)?tsx?$/;
|
|
24
|
+
/**
|
|
25
|
+
* Whether `id` is inside the set this plugin reflects — the same `FILTER` the
|
|
26
|
+
* `transform` hook tests at runtime, not a second copy of the regex.
|
|
27
|
+
*
|
|
28
|
+
* Exists because that filter is also a load-bearing DEPENDENCY of anything that
|
|
29
|
+
* mints a virtual module id meant to be reflected: `@gjsify/rolldown-plugin-vue`
|
|
30
|
+
* appends a `.gjsify-vue.ts` tail to route `.vue` SFCs through TypeScript parsing,
|
|
31
|
+
* and the same tail is what makes deepkit see the id at all (`status/open-todos.md`
|
|
32
|
+
* § "The Vue plugin's virtual suffix is coupled to deepkit's filter"). A silent
|
|
33
|
+
* drift here switches reflection off for every consumer with no diagnostic — the
|
|
34
|
+
* build still exits 0.
|
|
35
|
+
*/
|
|
36
|
+
export function reflectsModuleId(id) {
|
|
37
|
+
return FILTER.test(id);
|
|
38
|
+
}
|
|
24
39
|
function printDiagnostics(...args) {
|
|
25
40
|
console.log('[deepkit] printDiagnostics', inspect(args, false, 10, true));
|
|
26
41
|
}
|
|
@@ -33,7 +48,7 @@ export function deepkitPlugin(options = {}) {
|
|
|
33
48
|
async handler(code, id) {
|
|
34
49
|
if (!reflection)
|
|
35
50
|
return null;
|
|
36
|
-
if (!
|
|
51
|
+
if (!reflectsModuleId(id))
|
|
37
52
|
return null;
|
|
38
53
|
try {
|
|
39
54
|
const loader = await getLoader();
|