@codegraft/unplugin 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +18 -0
- package/dist/core.d.ts +31 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +44 -0
- package/dist/core.js.map +1 -0
- package/dist/esbuild.d.ts +5 -0
- package/dist/esbuild.d.ts.map +1 -0
- package/dist/esbuild.js +4 -0
- package/dist/esbuild.js.map +1 -0
- package/dist/farm.d.ts +5 -0
- package/dist/farm.d.ts.map +1 -0
- package/dist/farm.js +4 -0
- package/dist/farm.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/rolldown.d.ts +5 -0
- package/dist/rolldown.d.ts.map +1 -0
- package/dist/rolldown.js +4 -0
- package/dist/rolldown.js.map +1 -0
- package/dist/rollup.d.ts +5 -0
- package/dist/rollup.d.ts.map +1 -0
- package/dist/rollup.js +4 -0
- package/dist/rollup.js.map +1 -0
- package/dist/rspack.d.ts +5 -0
- package/dist/rspack.d.ts.map +1 -0
- package/dist/rspack.js +4 -0
- package/dist/rspack.js.map +1 -0
- package/dist/vite.d.ts +5 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +4 -0
- package/dist/vite.js.map +1 -0
- package/dist/webpack.d.ts +5 -0
- package/dist/webpack.d.ts.map +1 -0
- package/dist/webpack.js +4 -0
- package/dist/webpack.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present Joël Charles
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @codegraft/unplugin
|
|
2
|
+
|
|
3
|
+
Apply [Codegraft](../../README.md) transforms inside a bundler, via
|
|
4
|
+
[unplugin](https://github.com/unjs/unplugin) — Vite, Rollup, Rolldown, esbuild, webpack,
|
|
5
|
+
Rspack, Farm.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
// vite.config.ts
|
|
9
|
+
import codegraft from '@codegraft/unplugin/vite'
|
|
10
|
+
import codemod from './bati-codemod'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
plugins: [codegraft({ codemod, context: { BATI: { has: (f) => f === 'auth' } } })],
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Options: `{ codemod, context, splitters?, include?, exclude? }`. Pass `splitters: [vueSplitter]`
|
|
18
|
+
(from `@codegraft/vue`) to handle `.vue`. Emits `{ code, map }`.
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FilterPattern, UnpluginOptions } from 'unplugin';
|
|
2
|
+
import type { GrammarId, Transformer, ZoneSplitter } from '@codegraft/core';
|
|
3
|
+
/** A codemod by shape — so the plugin needn't depend on `@codegraft/codemod` just for a type. */
|
|
4
|
+
interface TransformerSource<Ctx extends Record<string, unknown>> {
|
|
5
|
+
forTarget(target: GrammarId | ZoneSplitter): Promise<Transformer<Ctx>>;
|
|
6
|
+
}
|
|
7
|
+
export interface CodegraftOptions<Ctx extends Record<string, unknown>> {
|
|
8
|
+
/** A `defineCodemod(...)` result. */
|
|
9
|
+
codemod: TransformerSource<Ctx>;
|
|
10
|
+
/** The run context threaded into every rewrite. */
|
|
11
|
+
context: Ctx;
|
|
12
|
+
/**
|
|
13
|
+
* SFC splitters to handle multi-zone formats, e.g. `[vueSplitter]` for `.vue`. A
|
|
14
|
+
* file is matched to a splitter when its extension equals the splitter's `id`
|
|
15
|
+
* (`vueSplitter.id === 'vue'` → `.vue`). Kept out of core so the plugin needn't
|
|
16
|
+
* depend on any splitter package.
|
|
17
|
+
*/
|
|
18
|
+
splitters?: ZoneSplitter[];
|
|
19
|
+
/** Limit which module ids are transformed (defaults to all handled extensions). */
|
|
20
|
+
include?: FilterPattern;
|
|
21
|
+
exclude?: FilterPattern;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The bundler-agnostic plugin body, shared by every adapter (`createUnplugin` turns it
|
|
25
|
+
* into Vite/Rollup/Rolldown/etc.). A module's extension selects a transformer (lazily
|
|
26
|
+
* `init`-ed once and cached), which runs with the build's context. Returns `null` when
|
|
27
|
+
* the file isn't handled or is unchanged, so the bundler skips it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function makeUnpluginOptions<Ctx extends Record<string, unknown>>(options: CodegraftOptions<Ctx>): UnpluginOptions;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG3E,iGAAiG;AACjG,UAAU,iBAAiB,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;CACvE;AAED,MAAM,WAAW,gBAAgB,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnE,qCAAqC;IACrC,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAA;IAC/B,mDAAmD;IACnD,OAAO,EAAE,GAAG,CAAA;IACZ;;;;;OAKG;IACH,SAAS,CAAC,EAAE,YAAY,EAAE,CAAA;IAC1B,mFAAmF;IACnF,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB;AAgBD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrE,OAAO,EAAE,gBAAgB,CAAC,GAAG,CAAC,GAC7B,eAAe,CAwBjB"}
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EXTENSION_GRAMMAR } from '@codegraft/core/internal';
|
|
2
|
+
function extensionOf(id) {
|
|
3
|
+
const dot = id.lastIndexOf('.');
|
|
4
|
+
return dot === -1 ? '' : id.slice(dot + 1).split(/[?#]/)[0]; // drop a Vite query/hash suffix
|
|
5
|
+
}
|
|
6
|
+
/** A file's transform target: a splitter (by id === extension) takes precedence over a
|
|
7
|
+
* single-grammar match. */
|
|
8
|
+
function targetForId(id, splitters) {
|
|
9
|
+
const ext = extensionOf(id);
|
|
10
|
+
return splitters.find((s) => s.id === ext) ?? EXTENSION_GRAMMAR[ext];
|
|
11
|
+
}
|
|
12
|
+
const cacheKey = (target) => (typeof target === 'string' ? target : target.id);
|
|
13
|
+
/**
|
|
14
|
+
* The bundler-agnostic plugin body, shared by every adapter (`createUnplugin` turns it
|
|
15
|
+
* into Vite/Rollup/Rolldown/etc.). A module's extension selects a transformer (lazily
|
|
16
|
+
* `init`-ed once and cached), which runs with the build's context. Returns `null` when
|
|
17
|
+
* the file isn't handled or is unchanged, so the bundler skips it.
|
|
18
|
+
*/
|
|
19
|
+
export function makeUnpluginOptions(options) {
|
|
20
|
+
const splitters = options.splitters ?? [];
|
|
21
|
+
const cache = new Map();
|
|
22
|
+
return {
|
|
23
|
+
name: '@codegraft/unplugin',
|
|
24
|
+
transform: {
|
|
25
|
+
// unplugin's native id filter applies include/exclude; the handler skips any
|
|
26
|
+
// extension Codegraft doesn't handle (returning null).
|
|
27
|
+
filter: { id: { include: options.include, exclude: options.exclude } },
|
|
28
|
+
async handler(code, id) {
|
|
29
|
+
const target = targetForId(id, splitters);
|
|
30
|
+
if (!target)
|
|
31
|
+
return null;
|
|
32
|
+
const key = cacheKey(target);
|
|
33
|
+
let pending = cache.get(key);
|
|
34
|
+
if (!pending) {
|
|
35
|
+
pending = options.codemod.forTarget(target);
|
|
36
|
+
cache.set(key, pending);
|
|
37
|
+
}
|
|
38
|
+
const result = (await pending).transformWithMap(code, options.context, { source: id });
|
|
39
|
+
return result.code === code ? null : { code: result.code, map: result.map };
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAwB5D,SAAS,WAAW,CAAC,EAAU;IAC7B,MAAM,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IAC/B,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,gCAAgC;AAC9F,CAAC;AAED;4BAC4B;AAC5B,SAAS,WAAW,CAAC,EAAU,EAAE,SAAyB;IACxD,MAAM,GAAG,GAAG,WAAW,CAAC,EAAE,CAAC,CAAA;IAC3B,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAA;AACtE,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,MAAgC,EAAE,EAAE,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAExG;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAA8B;IAE9B,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAA;IACzC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAqC,CAAA;IAE1D,OAAO;QACL,IAAI,EAAE,qBAAqB;QAC3B,SAAS,EAAE;YACT,6EAA6E;YAC7E,uDAAuD;YACvD,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE;YACtE,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE;gBACpB,MAAM,MAAM,GAAG,WAAW,CAAC,EAAE,EAAE,SAAS,CAAC,CAAA;gBACzC,IAAI,CAAC,MAAM;oBAAE,OAAO,IAAI,CAAA;gBACxB,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;gBAC5B,IAAI,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;gBAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;oBAC3C,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;gBACzB,CAAC;gBACD,MAAM,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAA;gBACtF,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAA;YAC7E,CAAC;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CodegraftOptions } from './core.js';
|
|
2
|
+
/** Codegraft plugin for esbuild: `plugins: [codegraft({ rules, context })]`. */
|
|
3
|
+
declare const _default: <Ctx extends Record<string, unknown>>(options: CodegraftOptions<Ctx>) => import("unplugin").EsbuildPlugin;
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=esbuild.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild.d.ts","sourceRoot":"","sources":["../src/esbuild.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD,gFAAgF;yBAChE,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,gBAAgB,CAAC,GAAG,CAAC;AAAnF,wBAC8B"}
|
package/dist/esbuild.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../src/esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAGtC,gFAAgF;AAChF,eAAe,CAAsC,OAA8B,EAAE,EAAE,CACrF,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAA"}
|
package/dist/farm.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CodegraftOptions } from './core.js';
|
|
2
|
+
/** Codegraft plugin for farm: `plugins: [codegraft({ rules, context })]`. */
|
|
3
|
+
declare const _default: <Ctx extends Record<string, unknown>>(options: CodegraftOptions<Ctx>) => JsPlugin;
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=farm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"farm.d.ts","sourceRoot":"","sources":["../src/farm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD,6EAA6E;yBAC7D,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,gBAAgB,CAAC,GAAG,CAAC;AAAnF,wBAC2B"}
|
package/dist/farm.js
ADDED
package/dist/farm.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"farm.js","sourceRoot":"","sources":["../src/farm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAGtC,6EAA6E;AAC7E,eAAe,CAAsC,OAA8B,EAAE,EAAE,CACrF,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CodegraftOptions } from './core.js';
|
|
2
|
+
/**
|
|
3
|
+
* The unified Codegraft plugin. `codegraft(options)` returns an unplugin instance — use
|
|
4
|
+
* `codegraft(opts).vite` / `.rollup` / `.rolldown` / `.esbuild` / `.webpack` / `.rspack` /
|
|
5
|
+
* `.farm`, or import a per-bundler entry (e.g. `@codegraft/unplugin/vite`) for the common
|
|
6
|
+
* `plugins: [codegraft(opts)]` shape.
|
|
7
|
+
*/
|
|
8
|
+
export declare function codegraft<Ctx extends Record<string, unknown>>(options: CodegraftOptions<Ctx>): import("unplugin").UnpluginInstance<unknown, boolean>;
|
|
9
|
+
export type { CodegraftOptions } from './core.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEtE;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,GAAG,CAAC,yDAE5F;AAED,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createUnplugin } from 'unplugin';
|
|
2
|
+
import { makeUnpluginOptions } from './core.js';
|
|
3
|
+
/**
|
|
4
|
+
* The unified Codegraft plugin. `codegraft(options)` returns an unplugin instance — use
|
|
5
|
+
* `codegraft(opts).vite` / `.rollup` / `.rolldown` / `.esbuild` / `.webpack` / `.rspack` /
|
|
6
|
+
* `.farm`, or import a per-bundler entry (e.g. `@codegraft/unplugin/vite`) for the common
|
|
7
|
+
* `plugins: [codegraft(opts)]` shape.
|
|
8
|
+
*/
|
|
9
|
+
export function codegraft(options) {
|
|
10
|
+
return createUnplugin(() => makeUnpluginOptions(options));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,mBAAmB,EAAyB,MAAM,WAAW,CAAA;AAEtE;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAsC,OAA8B;IAC3F,OAAO,cAAc,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAA;AAC3D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CodegraftOptions } from './core.js';
|
|
2
|
+
/** Codegraft plugin for rolldown: `plugins: [codegraft({ rules, context })]`. */
|
|
3
|
+
declare const _default: <Ctx extends Record<string, unknown>>(options: CodegraftOptions<Ctx>) => any;
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=rolldown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown.d.ts","sourceRoot":"","sources":["../src/rolldown.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD,iFAAiF;yBACjE,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,gBAAgB,CAAC,GAAG,CAAC;AAAnF,wBAC+B"}
|
package/dist/rolldown.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown.js","sourceRoot":"","sources":["../src/rolldown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAGtC,iFAAiF;AACjF,eAAe,CAAsC,OAA8B,EAAE,EAAE,CACrF,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAA"}
|
package/dist/rollup.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CodegraftOptions } from './core.js';
|
|
2
|
+
/** Codegraft plugin for rollup: `plugins: [codegraft({ rules, context })]`. */
|
|
3
|
+
declare const _default: <Ctx extends Record<string, unknown>>(options: CodegraftOptions<Ctx>) => import("rollup").Plugin<any> | import("rollup").Plugin<any>[];
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=rollup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD,+EAA+E;yBAC/D,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,gBAAgB,CAAC,GAAG,CAAC;AAAnF,wBAC6B"}
|
package/dist/rollup.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAGtC,+EAA+E;AAC/E,eAAe,CAAsC,OAA8B,EAAE,EAAE,CACrF,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAA"}
|
package/dist/rspack.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CodegraftOptions } from './core.js';
|
|
2
|
+
/** Codegraft plugin for rspack: `plugins: [codegraft({ rules, context })]`. */
|
|
3
|
+
declare const _default: <Ctx extends Record<string, unknown>>(options: CodegraftOptions<Ctx>) => RspackPluginInstance;
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=rspack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../src/rspack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD,+EAA+E;yBAC/D,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,gBAAgB,CAAC,GAAG,CAAC;AAAnF,wBAC6B"}
|
package/dist/rspack.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.js","sourceRoot":"","sources":["../src/rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAGtC,+EAA+E;AAC/E,eAAe,CAAsC,OAA8B,EAAE,EAAE,CACrF,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAA"}
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CodegraftOptions } from './core.js';
|
|
2
|
+
/** Codegraft plugin for vite: `plugins: [codegraft({ rules, context })]`. */
|
|
3
|
+
declare const _default: <Ctx extends Record<string, unknown>>(options: CodegraftOptions<Ctx>) => import("unplugin").VitePlugin<any> | import("unplugin").VitePlugin<any>[];
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=vite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD,6EAA6E;yBAC7D,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,gBAAgB,CAAC,GAAG,CAAC;AAAnF,wBAC2B"}
|
package/dist/vite.js
ADDED
package/dist/vite.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAGtC,6EAA6E;AAC7E,eAAe,CAAsC,OAA8B,EAAE,EAAE,CACrF,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CodegraftOptions } from './core.js';
|
|
2
|
+
/** Codegraft plugin for webpack: `plugins: [codegraft({ rules, context })]`. */
|
|
3
|
+
declare const _default: <Ctx extends Record<string, unknown>>(options: CodegraftOptions<Ctx>) => WebpackPluginInstance;
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=webpack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD,gFAAgF;yBAChE,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,gBAAgB,CAAC,GAAG,CAAC;AAAnF,wBAC8B"}
|
package/dist/webpack.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.js","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAGtC,gFAAgF;AAChF,eAAe,CAAsC,OAA8B,EAAE,EAAE,CACrF,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codegraft/unplugin",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"description": "Apply Codegraft transforms inside a bundler — Vite / Rollup / Rolldown / esbuild / webpack / Rspack / Farm.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/magne4000/codegraft.git",
|
|
11
|
+
"directory": "packages/unplugin"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/magne4000/codegraft#readme",
|
|
14
|
+
"bugs": "https://github.com/magne4000/codegraft/issues",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./vite": {
|
|
24
|
+
"import": "./dist/vite.js",
|
|
25
|
+
"types": "./dist/vite.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./rollup": {
|
|
28
|
+
"import": "./dist/rollup.js",
|
|
29
|
+
"types": "./dist/rollup.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./rolldown": {
|
|
32
|
+
"import": "./dist/rolldown.js",
|
|
33
|
+
"types": "./dist/rolldown.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./esbuild": {
|
|
36
|
+
"import": "./dist/esbuild.js",
|
|
37
|
+
"types": "./dist/esbuild.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./webpack": {
|
|
40
|
+
"import": "./dist/webpack.js",
|
|
41
|
+
"types": "./dist/webpack.d.ts"
|
|
42
|
+
},
|
|
43
|
+
"./rspack": {
|
|
44
|
+
"import": "./dist/rspack.js",
|
|
45
|
+
"types": "./dist/rspack.d.ts"
|
|
46
|
+
},
|
|
47
|
+
"./farm": {
|
|
48
|
+
"import": "./dist/farm.js",
|
|
49
|
+
"types": "./dist/farm.d.ts"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=22.13"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"unplugin": "^3.0.0",
|
|
57
|
+
"@codegraft/core": "0.1.0-beta.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"rollup": "^4.0.0",
|
|
61
|
+
"@codegraft/codemod": "0.1.0-beta.0",
|
|
62
|
+
"@codegraft/vue": "0.1.0-beta.0"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc -b"
|
|
66
|
+
}
|
|
67
|
+
}
|