@macroforge/shared 0.1.40
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/dist/config.d.ts +108 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +111 -0
- package/dist/config.js.map +1 -0
- package/dist/external-manifest.d.ts +75 -0
- package/dist/external-manifest.d.ts.map +1 -0
- package/dist/external-manifest.js +105 -0
- package/dist/external-manifest.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/macro-imports.d.ts +24 -0
- package/dist/macro-imports.d.ts.map +1 -0
- package/dist/macro-imports.js +39 -0
- package/dist/macro-imports.js.map +1 -0
- package/package.json +35 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module config
|
|
3
|
+
*
|
|
4
|
+
* Utilities for loading Macroforge configuration files.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Supported config file names in order of precedence.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CONFIG_FILES: readonly ["macroforge.config.ts", "macroforge.config.mts", "macroforge.config.js", "macroforge.config.mjs", "macroforge.config.cjs"];
|
|
10
|
+
/**
|
|
11
|
+
* Result from parsing a config file.
|
|
12
|
+
*/
|
|
13
|
+
export interface ConfigLoadResult {
|
|
14
|
+
keepDecorators: boolean;
|
|
15
|
+
generateConvenienceConst: boolean;
|
|
16
|
+
hasForeignTypes: boolean;
|
|
17
|
+
foreignTypeCount: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Configuration options loaded from `macroforge.config.js` (or .ts/.mjs/.cjs).
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* This configuration affects how macros are expanded and what artifacts
|
|
24
|
+
* are preserved in the output.
|
|
25
|
+
*/
|
|
26
|
+
export interface MacroConfig {
|
|
27
|
+
/**
|
|
28
|
+
* Whether to preserve `@derive` decorators in the output code after macro expansion.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* When `false` (default), decorators are removed after expansion since they serve
|
|
32
|
+
* only as compile-time directives. When `true`, decorators are kept in the output,
|
|
33
|
+
* which can be useful for debugging or when using runtime reflection.
|
|
34
|
+
*/
|
|
35
|
+
keepDecorators: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to generate a convenience const for non-class types.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* When `true` (default), generates an `export const TypeName = { ... } as const;`
|
|
41
|
+
* that groups all generated functions for a type into a single namespace-like object.
|
|
42
|
+
* For example: `export const User = { clone: userClone, serialize: userSerialize } as const;`
|
|
43
|
+
*
|
|
44
|
+
* When `false`, only the standalone functions are generated without the grouping const.
|
|
45
|
+
*/
|
|
46
|
+
generateConvenienceConst?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Path to the config file (used to cache and retrieve foreign types).
|
|
49
|
+
*/
|
|
50
|
+
configPath?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the config has foreign type handlers defined.
|
|
53
|
+
*/
|
|
54
|
+
hasForeignTypes?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Function type for loading config content.
|
|
58
|
+
* This allows plugins to inject their own config loading mechanism.
|
|
59
|
+
*/
|
|
60
|
+
export type ConfigLoader = (content: string, filepath: string) => ConfigLoadResult;
|
|
61
|
+
/**
|
|
62
|
+
* Finds a macroforge config file in the directory tree.
|
|
63
|
+
*
|
|
64
|
+
* @param startDir - The directory to start searching from
|
|
65
|
+
* @returns The path to the config file, or null if not found
|
|
66
|
+
*
|
|
67
|
+
* @remarks
|
|
68
|
+
* The search stops when:
|
|
69
|
+
* - A config file is found
|
|
70
|
+
* - A package.json boundary is reached
|
|
71
|
+
* - The filesystem root is reached
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const configPath = findConfigFile('/project/src/components');
|
|
76
|
+
* // => '/project/macroforge.config.js' or null
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function findConfigFile(startDir: string): string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Loads Macroforge configuration from `macroforge.config.js` (or .ts/.mjs/.cjs).
|
|
82
|
+
*
|
|
83
|
+
* @remarks
|
|
84
|
+
* Starting from the given directory, this function walks up the filesystem hierarchy
|
|
85
|
+
* looking for a macroforge config file. The first one found is parsed using the
|
|
86
|
+
* provided loader function (if any), which extracts configuration including
|
|
87
|
+
* foreign type handlers.
|
|
88
|
+
*
|
|
89
|
+
* @param startDir - The directory to start searching from (typically the project root)
|
|
90
|
+
* @param loadConfigFn - Optional function to parse the config file content.
|
|
91
|
+
* If provided, will be called with (content, filepath).
|
|
92
|
+
* If not provided, only the configPath will be set.
|
|
93
|
+
*
|
|
94
|
+
* @returns The loaded configuration, or default values if no config file is found
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* // Basic usage (no parsing, just find the config path)
|
|
99
|
+
* const config = loadMacroConfig('/project/src');
|
|
100
|
+
* // => { keepDecorators: false, configPath: '/project/macroforge.config.js' }
|
|
101
|
+
*
|
|
102
|
+
* // With Rust binary parser
|
|
103
|
+
* const config = loadMacroConfig('/project/src', rustTransformer.loadConfig);
|
|
104
|
+
* // => { keepDecorators: true, configPath: '...', hasForeignTypes: true }
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare function loadMacroConfig(startDir: string, loadConfigFn?: ConfigLoader): MacroConfig;
|
|
108
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,eAAO,MAAM,YAAY,sIAMf,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,wBAAwB,EAAE,OAAO,CAAC;IAClC,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;OAOG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CACzB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,KACb,gBAAgB,CAAC;AAEtB;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsB9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,YAAY,GAC1B,WAAW,CA8Bb"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module config
|
|
3
|
+
*
|
|
4
|
+
* Utilities for loading Macroforge configuration files.
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from "fs";
|
|
7
|
+
import * as path from "path";
|
|
8
|
+
/**
|
|
9
|
+
* Supported config file names in order of precedence.
|
|
10
|
+
*/
|
|
11
|
+
export const CONFIG_FILES = [
|
|
12
|
+
"macroforge.config.ts",
|
|
13
|
+
"macroforge.config.mts",
|
|
14
|
+
"macroforge.config.js",
|
|
15
|
+
"macroforge.config.mjs",
|
|
16
|
+
"macroforge.config.cjs",
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Finds a macroforge config file in the directory tree.
|
|
20
|
+
*
|
|
21
|
+
* @param startDir - The directory to start searching from
|
|
22
|
+
* @returns The path to the config file, or null if not found
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* The search stops when:
|
|
26
|
+
* - A config file is found
|
|
27
|
+
* - A package.json boundary is reached
|
|
28
|
+
* - The filesystem root is reached
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const configPath = findConfigFile('/project/src/components');
|
|
33
|
+
* // => '/project/macroforge.config.js' or null
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function findConfigFile(startDir) {
|
|
37
|
+
let current = startDir;
|
|
38
|
+
while (true) {
|
|
39
|
+
for (const filename of CONFIG_FILES) {
|
|
40
|
+
const candidate = path.join(current, filename);
|
|
41
|
+
if (fs.existsSync(candidate)) {
|
|
42
|
+
return candidate;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Stop at package.json boundary
|
|
46
|
+
if (fs.existsSync(path.join(current, "package.json"))) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
const parent = path.dirname(current);
|
|
50
|
+
if (parent === current)
|
|
51
|
+
break;
|
|
52
|
+
current = parent;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Loads Macroforge configuration from `macroforge.config.js` (or .ts/.mjs/.cjs).
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* Starting from the given directory, this function walks up the filesystem hierarchy
|
|
61
|
+
* looking for a macroforge config file. The first one found is parsed using the
|
|
62
|
+
* provided loader function (if any), which extracts configuration including
|
|
63
|
+
* foreign type handlers.
|
|
64
|
+
*
|
|
65
|
+
* @param startDir - The directory to start searching from (typically the project root)
|
|
66
|
+
* @param loadConfigFn - Optional function to parse the config file content.
|
|
67
|
+
* If provided, will be called with (content, filepath).
|
|
68
|
+
* If not provided, only the configPath will be set.
|
|
69
|
+
*
|
|
70
|
+
* @returns The loaded configuration, or default values if no config file is found
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* // Basic usage (no parsing, just find the config path)
|
|
75
|
+
* const config = loadMacroConfig('/project/src');
|
|
76
|
+
* // => { keepDecorators: false, configPath: '/project/macroforge.config.js' }
|
|
77
|
+
*
|
|
78
|
+
* // With Rust binary parser
|
|
79
|
+
* const config = loadMacroConfig('/project/src', rustTransformer.loadConfig);
|
|
80
|
+
* // => { keepDecorators: true, configPath: '...', hasForeignTypes: true }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export function loadMacroConfig(startDir, loadConfigFn) {
|
|
84
|
+
const fallback = { keepDecorators: false };
|
|
85
|
+
const configPath = findConfigFile(startDir);
|
|
86
|
+
if (!configPath) {
|
|
87
|
+
return fallback;
|
|
88
|
+
}
|
|
89
|
+
// If a loader function is provided, use it to parse the config
|
|
90
|
+
if (loadConfigFn) {
|
|
91
|
+
try {
|
|
92
|
+
const content = fs.readFileSync(configPath, "utf8");
|
|
93
|
+
const result = loadConfigFn(content, configPath);
|
|
94
|
+
return {
|
|
95
|
+
keepDecorators: result.keepDecorators,
|
|
96
|
+
generateConvenienceConst: result.generateConvenienceConst,
|
|
97
|
+
configPath,
|
|
98
|
+
hasForeignTypes: result.hasForeignTypes,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// Fall through to fallback
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Fallback: just mark the path but use defaults
|
|
106
|
+
return {
|
|
107
|
+
...fallback,
|
|
108
|
+
configPath,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,sBAAsB;IACtB,uBAAuB;IACvB,sBAAsB;IACtB,uBAAuB;IACvB,uBAAuB;CACf,CAAC;AA8DX;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,IAAI,OAAO,GAAG,QAAQ,CAAC;IAEvB,OAAO,IAAI,EAAE,CAAC;QACZ,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;YACpC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC/C,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC7B,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QAED,gCAAgC;QAChC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YACtD,MAAM;QACR,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,OAAO;YAAE,MAAM;QAC9B,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,YAA2B;IAE3B,MAAM,QAAQ,GAAgB,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAExD,MAAM,UAAU,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC5C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,+DAA+D;IAC/D,IAAI,YAAY,EAAE,CAAC;QACjB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YACpD,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YAEjD,OAAO;gBACL,cAAc,EAAE,MAAM,CAAC,cAAc;gBACrC,wBAAwB,EAAE,MAAM,CAAC,wBAAwB;gBACzD,UAAU;gBACV,eAAe,EAAE,MAAM,CAAC,eAAe;aACxC,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,2BAA2B;QAC7B,CAAC;IACH,CAAC;IAED,gDAAgD;IAChD,OAAO;QACL,GAAG,QAAQ;QACX,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module external-manifest
|
|
3
|
+
*
|
|
4
|
+
* Utilities for loading and caching external macro package manifests.
|
|
5
|
+
*/
|
|
6
|
+
import type { MacroManifest, MacroManifestEntry, DecoratorManifestEntry } from "macroforge";
|
|
7
|
+
/**
|
|
8
|
+
* Function type for requiring modules.
|
|
9
|
+
* Accepts any function that can load a module by path.
|
|
10
|
+
*/
|
|
11
|
+
export type RequireFunction = (id: string) => any;
|
|
12
|
+
/**
|
|
13
|
+
* Clears the external manifest cache.
|
|
14
|
+
* Useful for testing or when packages may have been updated.
|
|
15
|
+
*/
|
|
16
|
+
export declare function clearExternalManifestCache(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Attempts to load the manifest from an external macro package.
|
|
19
|
+
*
|
|
20
|
+
* External macro packages (like `@playground/macro`) export their own
|
|
21
|
+
* `__macroforgeGetManifest()` function that provides macro metadata
|
|
22
|
+
* including descriptions.
|
|
23
|
+
*
|
|
24
|
+
* @param modulePath - The package path (e.g., "@playground/macro")
|
|
25
|
+
* @param requireFn - Optional custom require function. If not provided, creates one using import.meta.url context.
|
|
26
|
+
* @returns The macro manifest, or null if loading failed
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // Basic usage
|
|
31
|
+
* const manifest = getExternalManifest("@playground/macro");
|
|
32
|
+
*
|
|
33
|
+
* // With custom require function (e.g., from vite-plugin)
|
|
34
|
+
* import { createRequire } from "module";
|
|
35
|
+
* const moduleRequire = createRequire(import.meta.url);
|
|
36
|
+
* const manifest = getExternalManifest("@playground/macro", moduleRequire);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function getExternalManifest(modulePath: string, requireFn?: RequireFunction): MacroManifest | null;
|
|
40
|
+
/**
|
|
41
|
+
* Looks up macro info from an external package manifest.
|
|
42
|
+
*
|
|
43
|
+
* @param macroName - The macro name to look up
|
|
44
|
+
* @param modulePath - The package path
|
|
45
|
+
* @param requireFn - Optional custom require function
|
|
46
|
+
* @returns The macro manifest entry, or null if not found
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const macroInfo = getExternalMacroInfo("Gigaform", "@playground/macro");
|
|
51
|
+
* if (macroInfo) {
|
|
52
|
+
* console.log(macroInfo.description);
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function getExternalMacroInfo(macroName: string, modulePath: string, requireFn?: RequireFunction): MacroManifestEntry | null;
|
|
57
|
+
/**
|
|
58
|
+
* Looks up decorator info from an external package manifest.
|
|
59
|
+
*
|
|
60
|
+
* @param decoratorName - The decorator name to look up
|
|
61
|
+
* @param modulePath - The package path
|
|
62
|
+
* @param requireFn - Optional custom require function
|
|
63
|
+
* @returns The decorator manifest entry, or null if not found
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const decoratorInfo = getExternalDecoratorInfo("hiddenController", "@playground/macro");
|
|
68
|
+
* if (decoratorInfo) {
|
|
69
|
+
* console.log(decoratorInfo.description);
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function getExternalDecoratorInfo(decoratorName: string, modulePath: string, requireFn?: RequireFunction): DecoratorManifestEntry | null;
|
|
74
|
+
export type { MacroManifest, MacroManifestEntry, DecoratorManifestEntry };
|
|
75
|
+
//# sourceMappingURL=external-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-manifest.d.ts","sourceRoot":"","sources":["../src/external-manifest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE5F;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,GAAG,CAAC;AAQlD;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,eAAe,GAC1B,aAAa,GAAG,IAAI,CAoBtB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,eAAe,GAC1B,kBAAkB,GAAG,IAAI,CAS3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,eAAe,GAC1B,sBAAsB,GAAG,IAAI,CAS/B;AAGD,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module external-manifest
|
|
3
|
+
*
|
|
4
|
+
* Utilities for loading and caching external macro package manifests.
|
|
5
|
+
*/
|
|
6
|
+
import { createRequire } from "module";
|
|
7
|
+
/**
|
|
8
|
+
* Cache for external macro package manifests.
|
|
9
|
+
* Maps package path to its manifest (or null if failed to load).
|
|
10
|
+
*/
|
|
11
|
+
const externalManifestCache = new Map();
|
|
12
|
+
/**
|
|
13
|
+
* Clears the external manifest cache.
|
|
14
|
+
* Useful for testing or when packages may have been updated.
|
|
15
|
+
*/
|
|
16
|
+
export function clearExternalManifestCache() {
|
|
17
|
+
externalManifestCache.clear();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Attempts to load the manifest from an external macro package.
|
|
21
|
+
*
|
|
22
|
+
* External macro packages (like `@playground/macro`) export their own
|
|
23
|
+
* `__macroforgeGetManifest()` function that provides macro metadata
|
|
24
|
+
* including descriptions.
|
|
25
|
+
*
|
|
26
|
+
* @param modulePath - The package path (e.g., "@playground/macro")
|
|
27
|
+
* @param requireFn - Optional custom require function. If not provided, creates one using import.meta.url context.
|
|
28
|
+
* @returns The macro manifest, or null if loading failed
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* // Basic usage
|
|
33
|
+
* const manifest = getExternalManifest("@playground/macro");
|
|
34
|
+
*
|
|
35
|
+
* // With custom require function (e.g., from vite-plugin)
|
|
36
|
+
* import { createRequire } from "module";
|
|
37
|
+
* const moduleRequire = createRequire(import.meta.url);
|
|
38
|
+
* const manifest = getExternalManifest("@playground/macro", moduleRequire);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function getExternalManifest(modulePath, requireFn) {
|
|
42
|
+
if (externalManifestCache.has(modulePath)) {
|
|
43
|
+
return externalManifestCache.get(modulePath) ?? null;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
// Use provided require function or create one
|
|
47
|
+
const req = requireFn ?? createRequire(import.meta.url);
|
|
48
|
+
const pkg = req(modulePath);
|
|
49
|
+
if (typeof pkg.__macroforgeGetManifest === "function") {
|
|
50
|
+
const manifest = pkg.__macroforgeGetManifest();
|
|
51
|
+
externalManifestCache.set(modulePath, manifest);
|
|
52
|
+
return manifest;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Package not found or doesn't export manifest
|
|
57
|
+
}
|
|
58
|
+
externalManifestCache.set(modulePath, null);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Looks up macro info from an external package manifest.
|
|
63
|
+
*
|
|
64
|
+
* @param macroName - The macro name to look up
|
|
65
|
+
* @param modulePath - The package path
|
|
66
|
+
* @param requireFn - Optional custom require function
|
|
67
|
+
* @returns The macro manifest entry, or null if not found
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const macroInfo = getExternalMacroInfo("Gigaform", "@playground/macro");
|
|
72
|
+
* if (macroInfo) {
|
|
73
|
+
* console.log(macroInfo.description);
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export function getExternalMacroInfo(macroName, modulePath, requireFn) {
|
|
78
|
+
const manifest = getExternalManifest(modulePath, requireFn);
|
|
79
|
+
if (!manifest)
|
|
80
|
+
return null;
|
|
81
|
+
return (manifest.macros.find((m) => m.name.toLowerCase() === macroName.toLowerCase()) ?? null);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Looks up decorator info from an external package manifest.
|
|
85
|
+
*
|
|
86
|
+
* @param decoratorName - The decorator name to look up
|
|
87
|
+
* @param modulePath - The package path
|
|
88
|
+
* @param requireFn - Optional custom require function
|
|
89
|
+
* @returns The decorator manifest entry, or null if not found
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const decoratorInfo = getExternalDecoratorInfo("hiddenController", "@playground/macro");
|
|
94
|
+
* if (decoratorInfo) {
|
|
95
|
+
* console.log(decoratorInfo.description);
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export function getExternalDecoratorInfo(decoratorName, modulePath, requireFn) {
|
|
100
|
+
const manifest = getExternalManifest(modulePath, requireFn);
|
|
101
|
+
if (!manifest)
|
|
102
|
+
return null;
|
|
103
|
+
return (manifest.decorators.find((d) => d.export.toLowerCase() === decoratorName.toLowerCase()) ?? null);
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=external-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-manifest.js","sourceRoot":"","sources":["../src/external-manifest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AASvC;;;GAGG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAgC,CAAC;AAEtE;;;GAGG;AACH,MAAM,UAAU,0BAA0B;IACxC,qBAAqB,CAAC,KAAK,EAAE,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAkB,EAClB,SAA2B;IAE3B,IAAI,qBAAqB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1C,OAAO,qBAAqB,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;IACvD,CAAC;IAED,IAAI,CAAC;QACH,8CAA8C;QAC9C,MAAM,GAAG,GAAG,SAAS,IAAI,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxD,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5B,IAAI,OAAO,GAAG,CAAC,uBAAuB,KAAK,UAAU,EAAE,CAAC;YACtD,MAAM,QAAQ,GAAkB,GAAG,CAAC,uBAAuB,EAAE,CAAC;YAC9D,qBAAqB,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAChD,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,+CAA+C;IACjD,CAAC;IAED,qBAAqB,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,oBAAoB,CAClC,SAAiB,EACjB,UAAkB,EAClB,SAA2B;IAE3B,MAAM,QAAQ,GAAG,mBAAmB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC5D,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,OAAO,CACL,QAAQ,CAAC,MAAM,CAAC,IAAI,CAClB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,WAAW,EAAE,CACxD,IAAI,IAAI,CACV,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,wBAAwB,CACtC,aAAqB,EACrB,UAAkB,EAClB,SAA2B;IAE3B,MAAM,QAAQ,GAAG,mBAAmB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC5D,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,OAAO,CACL,QAAQ,CAAC,UAAU,CAAC,IAAI,CACtB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,CAC9D,IAAI,IAAI,CACV,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @macroforge/shared
|
|
3
|
+
*
|
|
4
|
+
* Shared utilities for Macroforge plugins.
|
|
5
|
+
*
|
|
6
|
+
* This package provides common functionality used by both `@macroforge/vite-plugin`
|
|
7
|
+
* and `@macroforge/typescript-plugin`, ensuring consistent behavior across
|
|
8
|
+
* different build tools.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
export { parseMacroImportComments } from "./macro-imports.js";
|
|
13
|
+
export { getExternalManifest, getExternalMacroInfo, getExternalDecoratorInfo, clearExternalManifestCache, type MacroManifest, type MacroManifestEntry, type DecoratorManifestEntry, type RequireFunction, } from "./external-manifest.js";
|
|
14
|
+
export { CONFIG_FILES, findConfigFile, loadMacroConfig, type MacroConfig, type ConfigLoader, type ConfigLoadResult, } from "./config.js";
|
|
15
|
+
import { type RequireFunction } from "./external-manifest.js";
|
|
16
|
+
/**
|
|
17
|
+
* Collects decorator modules from external macro packages referenced in the code.
|
|
18
|
+
*
|
|
19
|
+
* This function parses macro import comments in the code to find external packages,
|
|
20
|
+
* then loads their manifests and collects all decorator module names.
|
|
21
|
+
*
|
|
22
|
+
* @param code - The TypeScript source code to scan
|
|
23
|
+
* @param requireFn - Optional custom require function for loading external packages
|
|
24
|
+
* @returns Array of decorator module names from external packages
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const code = `/** import macro {Gigaform} from "@playground/macro"; */
|
|
29
|
+
* /** @derive(Gigaform) */
|
|
30
|
+
* class MyForm {}`;
|
|
31
|
+
*
|
|
32
|
+
* const modules = collectExternalDecoratorModules(code);
|
|
33
|
+
* // => ["hiddenController", "fieldController", ...]
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function collectExternalDecoratorModules(code: string, requireFn?: RequireFunction): string[];
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,eAAe,GAC1B,MAAM,EAAE,CAQV"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @macroforge/shared
|
|
3
|
+
*
|
|
4
|
+
* Shared utilities for Macroforge plugins.
|
|
5
|
+
*
|
|
6
|
+
* This package provides common functionality used by both `@macroforge/vite-plugin`
|
|
7
|
+
* and `@macroforge/typescript-plugin`, ensuring consistent behavior across
|
|
8
|
+
* different build tools.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
// Re-export all utilities
|
|
13
|
+
export { parseMacroImportComments } from "./macro-imports.js";
|
|
14
|
+
export { getExternalManifest, getExternalMacroInfo, getExternalDecoratorInfo, clearExternalManifestCache, } from "./external-manifest.js";
|
|
15
|
+
export { CONFIG_FILES, findConfigFile, loadMacroConfig, } from "./config.js";
|
|
16
|
+
// Import for composite functions
|
|
17
|
+
import { parseMacroImportComments } from "./macro-imports.js";
|
|
18
|
+
import { getExternalManifest } from "./external-manifest.js";
|
|
19
|
+
/**
|
|
20
|
+
* Collects decorator modules from external macro packages referenced in the code.
|
|
21
|
+
*
|
|
22
|
+
* This function parses macro import comments in the code to find external packages,
|
|
23
|
+
* then loads their manifests and collects all decorator module names.
|
|
24
|
+
*
|
|
25
|
+
* @param code - The TypeScript source code to scan
|
|
26
|
+
* @param requireFn - Optional custom require function for loading external packages
|
|
27
|
+
* @returns Array of decorator module names from external packages
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const code = `/** import macro {Gigaform} from "@playground/macro"; */
|
|
32
|
+
* /** @derive(Gigaform) */
|
|
33
|
+
* class MyForm {}`;
|
|
34
|
+
*
|
|
35
|
+
* const modules = collectExternalDecoratorModules(code);
|
|
36
|
+
* // => ["hiddenController", "fieldController", ...]
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export function collectExternalDecoratorModules(code, requireFn) {
|
|
40
|
+
const imports = parseMacroImportComments(code);
|
|
41
|
+
const modulePaths = [...new Set(imports.values())];
|
|
42
|
+
return modulePaths.flatMap((modulePath) => {
|
|
43
|
+
const manifest = getExternalManifest(modulePath, requireFn);
|
|
44
|
+
return manifest?.decorators.map((d) => d.module) ?? [];
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0BAA0B;AAC1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,GAK3B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,GAIhB,MAAM,aAAa,CAAC;AAErB,iCAAiC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAwB,MAAM,wBAAwB,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,+BAA+B,CAC7C,IAAY,EACZ,SAA2B;IAE3B,MAAM,OAAO,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAEnD,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QACxC,MAAM,QAAQ,GAAG,mBAAmB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC5D,OAAO,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module macro-imports
|
|
3
|
+
*
|
|
4
|
+
* Utilities for parsing macro import comments in TypeScript code.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Parses macro import comments from TypeScript code.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Extracts macro names mapped to their source module paths from
|
|
11
|
+
* `/** import macro { ... } from "package" */` comments.
|
|
12
|
+
*
|
|
13
|
+
* @param text - The TypeScript source code to parse
|
|
14
|
+
* @returns Map of macro names to their module paths
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const text = `/** import macro {JSON, FieldController} from "@playground/macro"; */`;
|
|
19
|
+
* parseMacroImportComments(text);
|
|
20
|
+
* // => Map { "JSON" => "@playground/macro", "FieldController" => "@playground/macro" }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseMacroImportComments(text: string): Map<string, string>;
|
|
24
|
+
//# sourceMappingURL=macro-imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"macro-imports.d.ts","sourceRoot":"","sources":["../src/macro-imports.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAiB1E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module macro-imports
|
|
3
|
+
*
|
|
4
|
+
* Utilities for parsing macro import comments in TypeScript code.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Parses macro import comments from TypeScript code.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Extracts macro names mapped to their source module paths from
|
|
11
|
+
* `/** import macro { ... } from "package" */` comments.
|
|
12
|
+
*
|
|
13
|
+
* @param text - The TypeScript source code to parse
|
|
14
|
+
* @returns Map of macro names to their module paths
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const text = `/** import macro {JSON, FieldController} from "@playground/macro"; */`;
|
|
19
|
+
* parseMacroImportComments(text);
|
|
20
|
+
* // => Map { "JSON" => "@playground/macro", "FieldController" => "@playground/macro" }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function parseMacroImportComments(text) {
|
|
24
|
+
const imports = new Map();
|
|
25
|
+
const pattern = /\/\*\*\s*import\s+macro\s*\{([^}]+)\}\s*from\s*["']([^"']+)["']/gi;
|
|
26
|
+
let match;
|
|
27
|
+
while ((match = pattern.exec(text)) !== null) {
|
|
28
|
+
const names = match[1]
|
|
29
|
+
.split(",")
|
|
30
|
+
.map((n) => n.trim())
|
|
31
|
+
.filter(Boolean);
|
|
32
|
+
const modulePath = match[2];
|
|
33
|
+
for (const name of names) {
|
|
34
|
+
imports.set(name, modulePath);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return imports;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=macro-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"macro-imports.js","sourceRoot":"","sources":["../src/macro-imports.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,MAAM,OAAO,GACX,mEAAmE,CAAC;IACtE,IAAI,KAA6B,CAAC;IAElC,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;aACnB,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACpB,MAAM,CAAC,OAAO,CAAC,CAAC;QACnB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@macroforge/shared",
|
|
3
|
+
"version": "0.1.40",
|
|
4
|
+
"description": "Shared utilities for Macroforge plugins",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/rymskip/macroforge-ts.git"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc -p tsconfig.json",
|
|
23
|
+
"clean": "rm -rf dist",
|
|
24
|
+
"cleanbuild": "npm run clean && npm run build"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"macroforge": "^0.1.40"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"typescript": ">=5.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"typescript": "^5.9.3"
|
|
34
|
+
}
|
|
35
|
+
}
|