codemod 2.0.0-alpha.1 → 2.0.0-alpha.3
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 +56 -2
- package/codemod +17 -30
- package/package.json +80 -10
- package/register.d.mts +2 -0
- package/register.mjs +67 -0
- package/runtime/addon.d.mts +114 -0
- package/runtime/addon.mjs +55 -0
- package/runtime/ast-grep.d.mts +20 -0
- package/runtime/ast-grep.mjs +82 -0
- package/runtime/context.d.mts +49 -0
- package/runtime/context.mjs +59 -0
- package/runtime/hooks.d.mts +2 -0
- package/runtime/hooks.mjs +7 -0
- package/runtime/host.d.mts +121 -0
- package/runtime/host.mjs +450 -0
- package/runtime/llm.d.mts +2 -0
- package/runtime/llm.mjs +5 -0
- package/runtime/metrics.d.mts +9 -0
- package/runtime/metrics.mjs +42 -0
- package/runtime/modules.d.mts +3 -0
- package/runtime/modules.mjs +17 -0
- package/runtime/orchestrator-version.d.mts +2 -0
- package/runtime/orchestrator-version.mjs +3 -0
- package/runtime/orchestrator.d.mts +261 -0
- package/runtime/orchestrator.mjs +879 -0
- package/runtime/runtime.d.mts +15 -0
- package/runtime/runtime.mjs +40 -0
- package/runtime/workflow.d.mts +19 -0
- package/runtime/workflow.mjs +126 -0
- package/testing/index.d.mts +157 -0
- package/testing/index.mjs +648 -0
- package/types/index.d.ts +8 -0
- package/types/langs/angular.d.ts +5 -0
- package/types/langs/c.d.ts +5 -0
- package/types/langs/c_sharp.d.ts +5 -0
- package/types/langs/cpp.d.ts +5 -0
- package/types/langs/css.d.ts +5 -0
- package/types/langs/elixir.d.ts +5 -0
- package/types/langs/go.d.ts +5 -0
- package/types/langs/html.d.ts +5 -0
- package/types/langs/java.d.ts +5 -0
- package/types/langs/javascript.d.ts +5 -0
- package/types/langs/json.d.ts +5 -0
- package/types/langs/kotlin.d.ts +5 -0
- package/types/langs/package.json +3 -0
- package/types/langs/php.d.ts +5 -0
- package/types/langs/python.d.ts +5 -0
- package/types/langs/ruby.d.ts +5 -0
- package/types/langs/rust.d.ts +5 -0
- package/types/langs/scala.d.ts +5 -0
- package/types/langs/toml.d.ts +5 -0
- package/types/langs/tsx.d.ts +5 -0
- package/types/langs/typescript.d.ts +5 -0
- package/types/langs/xml.d.ts +5 -0
- package/types/langs/yaml.d.ts +5 -0
- package/types/llm.d.ts +6 -0
- package/types/llrt/abort.d.ts +69 -0
- package/types/llrt/assert.d.ts +39 -0
- package/types/llrt/async_hooks.d.ts +210 -0
- package/types/llrt/buffer.d.ts +1186 -0
- package/types/llrt/child_process.d.ts +447 -0
- package/types/llrt/console.d.ts +210 -0
- package/types/llrt/crypto.d.ts +854 -0
- package/types/llrt/dgram.d.ts +381 -0
- package/types/llrt/dns.d.ts +124 -0
- package/types/llrt/dom-events.d.ts +51 -0
- package/types/llrt/events.d.ts +245 -0
- package/types/llrt/exceptions.d.ts +26 -0
- package/types/llrt/fetch.d.ts +332 -0
- package/types/llrt/fs/promises.d.ts +554 -0
- package/types/llrt/fs.d.ts +360 -0
- package/types/llrt/globals.d.ts +23 -0
- package/types/llrt/https.d.ts +27 -0
- package/types/llrt/index.d.ts +33 -0
- package/types/llrt/module.d.ts +285 -0
- package/types/llrt/navigator.d.ts +9 -0
- package/types/llrt/net.d.ts +488 -0
- package/types/llrt/os.d.ts +293 -0
- package/types/llrt/path.d.ts +150 -0
- package/types/llrt/perf_hooks.d.ts +23 -0
- package/types/llrt/process.d.ts +502 -0
- package/types/llrt/stream/web.d.ts +526 -0
- package/types/llrt/stream.d.ts +366 -0
- package/types/llrt/string_decoder.d.ts +63 -0
- package/types/llrt/timers.d.ts +72 -0
- package/types/llrt/timezone.d.ts +101 -0
- package/types/llrt/tty.d.ts +11 -0
- package/types/llrt/url.d.ts +774 -0
- package/types/llrt/util.d.ts +240 -0
- package/types/llrt/zlib.d.ts +177 -0
- package/types/main.d.ts +5 -0
- package/types/metrics.d.ts +5 -0
- package/types/modules/ast-grep.d.ts +634 -0
- package/types/modules/langs.d.ts +87 -0
- package/types/modules/llm.d.ts +23 -0
- package/types/modules/metrics.d.ts +107 -0
- package/types/modules/runtime.d.ts +66 -0
- package/types/modules/workflow.d.ts +915 -0
- package/types/runtime.d.ts +6 -0
- package/types/workflow.d.ts +5 -0
- package/vite.d.mts +7 -0
- package/vite.mjs +32 -0
package/vite.d.mts
ADDED
package/vite.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// `codemod/vite`: a Vite (and Vitest) plugin for code written with the older
|
|
2
|
+
// `codemod:workflow`, `codemod:ast-grep`, ... spelling: it resolves those to
|
|
3
|
+
// this package's `codemod/*` exports. Code that imports `codemod/*` needs no
|
|
4
|
+
// plugin.
|
|
5
|
+
/**
|
|
6
|
+
* A Vite (and Vitest) plugin that resolves the older `codemod:*` spelling of
|
|
7
|
+
* the codemod modules (`codemod:workflow`) to the `codemod/*` exports. Code
|
|
8
|
+
* that imports `codemod/*` needs no plugin.
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* // vitest.config.ts
|
|
12
|
+
* import { defineConfig } from "vitest/config";
|
|
13
|
+
* import codemod from "codemod/vite";
|
|
14
|
+
*
|
|
15
|
+
* export default defineConfig({ plugins: [codemod()] });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { fileURLToPath } from "node:url";
|
|
21
|
+
import { resolveCodemodModule } from "./runtime/modules.mjs";
|
|
22
|
+
export function codemod() {
|
|
23
|
+
return {
|
|
24
|
+
name: "codemod",
|
|
25
|
+
enforce: "pre",
|
|
26
|
+
resolveId(id) {
|
|
27
|
+
const url = resolveCodemodModule(id);
|
|
28
|
+
return url ? fileURLToPath(url) : null;
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export default codemod;
|