pi-codex-marketplace 1.0.0 → 1.0.1
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/bin/ts-resolver.mjs +33 -0
- package/package.json +1 -1
package/bin/ts-resolver.mjs
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { stripTypeScriptTypes } from "node:module";
|
|
3
|
+
|
|
4
|
+
const STRIP_TYPES_WARNING = "stripTypeScriptTypes is an experimental feature and might change at any time";
|
|
5
|
+
|
|
6
|
+
function stripTypes(source) {
|
|
7
|
+
const emitWarning = process.emitWarning;
|
|
8
|
+
process.emitWarning = (warning, ...args) => {
|
|
9
|
+
const message = warning instanceof Error ? warning.message : String(warning);
|
|
10
|
+
if (message === STRIP_TYPES_WARNING) return;
|
|
11
|
+
emitWarning.call(process, warning, ...args);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
return stripTypeScriptTypes(source, { mode: "strip" });
|
|
16
|
+
} finally {
|
|
17
|
+
process.emitWarning = emitWarning;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
1
21
|
export async function resolve(specifier, context, nextResolve) {
|
|
2
22
|
try {
|
|
3
23
|
return await nextResolve(specifier, context);
|
|
@@ -13,3 +33,16 @@ export async function resolve(specifier, context, nextResolve) {
|
|
|
13
33
|
throw err;
|
|
14
34
|
}
|
|
15
35
|
}
|
|
36
|
+
|
|
37
|
+
export async function load(url, context, nextLoad) {
|
|
38
|
+
if (!url.endsWith(".ts")) {
|
|
39
|
+
return nextLoad(url, context);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const source = await readFile(new URL(url), "utf8");
|
|
43
|
+
return {
|
|
44
|
+
format: "module",
|
|
45
|
+
shortCircuit: true,
|
|
46
|
+
source: stripTypes(source),
|
|
47
|
+
};
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-codex-marketplace",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Bridge Package for Codex and Claude Marketplace compatibility in Pi — 極簡 /codex-marketplace 純文字指令與 Headless CLI(add/list/install/update/disable/enable/remove/forget)、單一 Global Bridge State、當下最新安裝與即時投影",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|