virtual-machine 0.0.4 → 0.0.14

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/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "build",
4
- "skipLibCheck": true,
5
- "moduleResolution": "bundler",
6
- "allowJs": true,
7
- "target": "es2022",
8
- "module": "es2022",
9
- "declaration": true,
10
- "emitDeclarationOnly": false,
11
- "esModuleInterop": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "moduleDetection": "force",
14
- "strict": true,
15
- "lib": ["ES2022", "DOM"],
16
- },
17
- "include": ["pkg", "index.ts"],
18
- "exclude": ["node_modules", "build"]
19
- }
package/tsup/index.ts DELETED
@@ -1,79 +0,0 @@
1
- /** biome-ignore-all lint/suspicious/noExplicitAny: Not needed here */
2
-
3
- import fs from "node:fs";
4
- import path from "node:path";
5
- import { NodeResolvePlugin } from "@esbuild-plugins/node-resolve";
6
- import { defineConfig, type Format } from "tsup";
7
-
8
- const packagesDir = path.resolve(process.cwd());
9
- export const wasmPlugin = {
10
- name: "wasm",
11
- setup(build: any) {
12
- build.onResolve({ filter: /\.wasm$/ }, (args: any) => {
13
- if (fs.existsSync(path.resolve(packagesDir, args.path))) {
14
- return { path: path.resolve(packagesDir, args.path), namespace: "wasm" };
15
- }
16
- return { path: path.resolve("node_modules", args.path), namespace: "wasm" };
17
- });
18
- build.onLoad({ filter: /.*/, namespace: "wasm" }, async (args: any) => {
19
- const buffer = await fs.promises.readFile(args.path);
20
- const base64 = buffer.toString("base64");
21
- return {
22
- contents: `export default Buffer.from("${base64}", "base64")`,
23
- loader: "js",
24
- };
25
- });
26
- },
27
- };
28
-
29
- export const plugins = [
30
- NodeResolvePlugin({
31
- extensions: [".ts", ".js", ".wasm"],
32
- onResolved: (resolved) => {
33
- if (resolved.includes("node_modules")) {
34
- return {
35
- external: true,
36
- };
37
- }
38
- return resolved;
39
- },
40
- }),
41
- ];
42
-
43
- export default function createConfig({
44
- format,
45
- entry,
46
- banner,
47
- platform,
48
- external
49
- }: {
50
- format: Format | Format[] | undefined;
51
- entry: string[] | undefined;
52
- banner?: { js: string };
53
- platform?: "neutral" | "node" | "browser";
54
- external?: string[] | undefined;
55
- }) {
56
- return defineConfig(({ watch: _watch }) => ({
57
- entry,
58
- format,
59
- outDir: "build",
60
- target: "esnext",
61
- minify: false,
62
- platform: platform || "neutral",
63
- clean: false,
64
- esbuildPlugins: [wasmPlugin, ...plugins],
65
- banner,
66
- esbuildOptions: (options, _context) => {
67
- options.platform = platform || "neutral";
68
- },
69
- external: [
70
- "buffer",
71
- "next",
72
- "vitest",
73
- "react-server-dom-webpack",
74
- "tsup",
75
- "react-server-dom-webpack/client.edge",
76
- ...(external ?? [])
77
- ],
78
- }));
79
- }
package/tsup/tsup.cli.ts DELETED
@@ -1,8 +0,0 @@
1
- import createConfig from './';
2
-
3
- export default createConfig({
4
- format: ['cjs'],
5
- entry: ['cli.ts'],
6
- external: ['yargs'],
7
- platform: 'node',
8
- });
@@ -1,7 +0,0 @@
1
-
2
-
3
- import createConfig from './';
4
- export default createConfig({
5
- format: ['cjs'],
6
- entry: ['index.ts'],
7
- });
@@ -1,8 +0,0 @@
1
-
2
-
3
- import createConfig from './';
4
- export default createConfig({
5
- format: ['esm'],
6
- entry: ['index.ts'],
7
-
8
- });