@ait-co/devtools 0.0.2 → 0.1.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/README.md +14 -6
- package/dist/mock/index.d.ts +571 -534
- package/dist/mock/index.d.ts.map +1 -0
- package/dist/mock/index.js +1030 -454
- package/dist/mock/index.js.map +1 -1
- package/dist/panel/index.d.ts +3 -1
- package/dist/panel/index.d.ts.map +1 -0
- package/dist/panel/index.js +1226 -683
- package/dist/panel/index.js.map +1 -1
- package/dist/unplugin/index.cjs +68 -73
- package/dist/unplugin/index.cjs.map +1 -1
- package/dist/unplugin/index.d.cts +10100 -22
- package/dist/unplugin/index.d.cts.map +1 -0
- package/dist/unplugin/index.d.ts +10100 -22
- package/dist/unplugin/index.d.ts.map +1 -0
- package/dist/unplugin/index.js +59 -44
- package/dist/unplugin/index.js.map +1 -1
- package/package.json +23 -15
- package/dist/chunk-6PPZTREF.js +0 -569
- package/dist/chunk-6PPZTREF.js.map +0 -1
package/dist/unplugin/index.js
CHANGED
|
@@ -1,47 +1,62 @@
|
|
|
1
|
-
// src/unplugin/index.ts
|
|
2
1
|
import { createUnplugin } from "unplugin";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
//#region src/unplugin/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* @ait-co/devtools unplugin
|
|
5
|
+
*
|
|
6
|
+
* 모든 주요 번들러를 지원하는 단일 플러그인.
|
|
7
|
+
* @apps-in-toss/web-framework → @ait-co/devtools/mock 으로 alias 설정.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* import aitDevtools from '@ait-co/devtools/unplugin';
|
|
11
|
+
*
|
|
12
|
+
* // Vite
|
|
13
|
+
* export default { plugins: [aitDevtools.vite()] };
|
|
14
|
+
*
|
|
15
|
+
* // Webpack / Next.js
|
|
16
|
+
* config.plugins.push(aitDevtools.webpack());
|
|
17
|
+
*
|
|
18
|
+
* // Rspack
|
|
19
|
+
* config.plugins.push(aitDevtools.rspack());
|
|
20
|
+
*
|
|
21
|
+
* // esbuild
|
|
22
|
+
* { plugins: [aitDevtools.esbuild()] }
|
|
23
|
+
*
|
|
24
|
+
* // Rollup
|
|
25
|
+
* { plugins: [aitDevtools.rollup()] }
|
|
26
|
+
*/
|
|
27
|
+
const FRAMEWORK_ID = "@apps-in-toss/web-framework";
|
|
28
|
+
const BRIDGE_ID = "@apps-in-toss/web-bridge";
|
|
29
|
+
const ANALYTICS_ID = "@apps-in-toss/web-analytics";
|
|
30
|
+
const aitDevtoolsPlugin = createUnplugin((options) => {
|
|
31
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
32
|
+
const shouldEnable = isDev || (options?.forceEnable ?? false);
|
|
33
|
+
const shouldMock = shouldEnable && (options?.mock ?? isDev);
|
|
34
|
+
const shouldPanel = shouldEnable && (options?.panel ?? true);
|
|
35
|
+
return {
|
|
36
|
+
name: "ait-co-devtools",
|
|
37
|
+
enforce: "pre",
|
|
38
|
+
resolveId(id) {
|
|
39
|
+
if (!shouldMock) return null;
|
|
40
|
+
if (id === FRAMEWORK_ID || id === BRIDGE_ID || id === ANALYTICS_ID) return "@ait-co/devtools/mock";
|
|
41
|
+
return null;
|
|
42
|
+
},
|
|
43
|
+
transformInclude(id) {
|
|
44
|
+
if (!shouldPanel) return false;
|
|
45
|
+
return /\.(tsx?|jsx?)$/.test(id) && /\/(main|index|entry|app)\.[tj]sx?$/i.test(id) && !id.includes("node_modules");
|
|
46
|
+
},
|
|
47
|
+
transform(code) {
|
|
48
|
+
if (!shouldPanel) return null;
|
|
49
|
+
if (code.includes("@ait-co/devtools/panel")) return null;
|
|
50
|
+
return `import '@ait-co/devtools/panel';\n${code}`;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
32
53
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
|
|
41
|
-
esbuild,
|
|
42
|
-
rollup,
|
|
43
|
-
rspack,
|
|
44
|
-
vite,
|
|
45
|
-
webpack
|
|
46
|
-
};
|
|
54
|
+
const vite = aitDevtoolsPlugin.vite;
|
|
55
|
+
const webpack = aitDevtoolsPlugin.webpack;
|
|
56
|
+
const rollup = aitDevtoolsPlugin.rollup;
|
|
57
|
+
const esbuild = aitDevtoolsPlugin.esbuild;
|
|
58
|
+
const rspack = aitDevtoolsPlugin.rspack;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { aitDevtoolsPlugin as default, esbuild, rollup, rspack, vite, webpack };
|
|
61
|
+
|
|
47
62
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/unplugin/index.ts"],"sourcesContent":["/**\n * @ait-co/devtools unplugin\n *\n * 모든 주요 번들러를 지원하는 단일 플러그인.\n * @apps-in-toss/web-framework → @ait-co/devtools/mock 으로 alias 설정.\n *\n * Usage:\n * import aitDevtools from '@ait-co/devtools/unplugin';\n *\n * // Vite\n * export default { plugins: [aitDevtools.vite()] };\n *\n * // Webpack / Next.js\n * config.plugins.push(aitDevtools.webpack());\n *\n * // Rspack\n * config.plugins.push(aitDevtools.rspack());\n *\n * // esbuild\n * { plugins: [aitDevtools.esbuild()] }\n *\n * // Rollup\n * { plugins: [aitDevtools.rollup()] }\n */\n\nimport { createUnplugin } from 'unplugin';\n\nexport interface AitDevtoolsOptions {\n /**\n * 패널 자동 주입 여부 (default: true)\n * true이면 진입점에 floating panel import를 자동 추가한다.\n */\n panel?: boolean;\n /**\n * production 환경에서도 devtools를 강제로 활성화 (default: false)\n */\n forceEnable?: boolean;\n /**\n * mock alias 활성화 여부. default: true (development), false (production + forceEnable)\n */\n mock?: boolean;\n}\n\nconst FRAMEWORK_ID = '@apps-in-toss/web-framework';\nconst BRIDGE_ID = '@apps-in-toss/web-bridge';\nconst ANALYTICS_ID = '@apps-in-toss/web-analytics';\n\nconst aitDevtoolsPlugin = createUnplugin((options?: AitDevtoolsOptions) => {\n const isDev = process.env.NODE_ENV !== 'production';\n const shouldEnable = isDev || (options?.forceEnable ?? false);\n const shouldMock = shouldEnable && (options?.mock ?? isDev);\n const shouldPanel = shouldEnable && (options?.panel ?? true);\n\n return {\n name: 'ait-co-devtools',\n enforce: 'pre' as const,\n\n resolveId(id: string) {\n if (!shouldMock) return null;\n // @apps-in-toss/web-framework → @ait-co/devtools/mock\n if (id === FRAMEWORK_ID || id === BRIDGE_ID || id === ANALYTICS_ID) {\n return '@ait-co/devtools/mock';\n }\n return null;\n },\n\n transformInclude(id: string) {\n if (!shouldPanel) return false;\n // 진입점 파일에만 패널 import를 주입\n return /\\.(tsx?|jsx?)$/.test(id)
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/unplugin/index.ts"],"sourcesContent":["/**\n * @ait-co/devtools unplugin\n *\n * 모든 주요 번들러를 지원하는 단일 플러그인.\n * @apps-in-toss/web-framework → @ait-co/devtools/mock 으로 alias 설정.\n *\n * Usage:\n * import aitDevtools from '@ait-co/devtools/unplugin';\n *\n * // Vite\n * export default { plugins: [aitDevtools.vite()] };\n *\n * // Webpack / Next.js\n * config.plugins.push(aitDevtools.webpack());\n *\n * // Rspack\n * config.plugins.push(aitDevtools.rspack());\n *\n * // esbuild\n * { plugins: [aitDevtools.esbuild()] }\n *\n * // Rollup\n * { plugins: [aitDevtools.rollup()] }\n */\n\nimport { createUnplugin } from 'unplugin';\n\nexport interface AitDevtoolsOptions {\n /**\n * 패널 자동 주입 여부 (default: true)\n * true이면 진입점에 floating panel import를 자동 추가한다.\n */\n panel?: boolean;\n /**\n * production 환경에서도 devtools를 강제로 활성화 (default: false)\n */\n forceEnable?: boolean;\n /**\n * mock alias 활성화 여부. default: true (development), false (production + forceEnable)\n */\n mock?: boolean;\n}\n\nconst FRAMEWORK_ID = '@apps-in-toss/web-framework';\nconst BRIDGE_ID = '@apps-in-toss/web-bridge';\nconst ANALYTICS_ID = '@apps-in-toss/web-analytics';\n\nconst aitDevtoolsPlugin = createUnplugin((options?: AitDevtoolsOptions) => {\n const isDev = process.env.NODE_ENV !== 'production';\n const shouldEnable = isDev || (options?.forceEnable ?? false);\n const shouldMock = shouldEnable && (options?.mock ?? isDev);\n const shouldPanel = shouldEnable && (options?.panel ?? true);\n\n return {\n name: 'ait-co-devtools',\n enforce: 'pre' as const,\n\n resolveId(id: string) {\n if (!shouldMock) return null;\n // @apps-in-toss/web-framework → @ait-co/devtools/mock\n if (id === FRAMEWORK_ID || id === BRIDGE_ID || id === ANALYTICS_ID) {\n return '@ait-co/devtools/mock';\n }\n return null;\n },\n\n transformInclude(id: string) {\n if (!shouldPanel) return false;\n // 진입점 파일에만 패널 import를 주입\n return (\n /\\.(tsx?|jsx?)$/.test(id) &&\n /\\/(main|index|entry|app)\\.[tj]sx?$/i.test(id) &&\n !id.includes('node_modules')\n );\n },\n\n transform(code: string) {\n // transformInclude가 이미 shouldPanel을 확인하지만, 안전망으로 유지\n if (!shouldPanel) return null;\n // 이미 패널이 import 되어있으면 스킵\n if (code.includes('@ait-co/devtools/panel')) return null;\n // transformInclude가 진입점 파일만 통과시키므로 바로 prepend\n return `import '@ait-co/devtools/panel';\\n${code}`;\n },\n };\n});\n\nexport const vite = aitDevtoolsPlugin.vite;\nexport const webpack = aitDevtoolsPlugin.webpack;\nexport const rollup = aitDevtoolsPlugin.rollup;\nexport const esbuild = aitDevtoolsPlugin.esbuild;\nexport const rspack = aitDevtoolsPlugin.rspack;\n\nexport default aitDevtoolsPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,eAAe;AACrB,MAAM,YAAY;AAClB,MAAM,eAAe;AAErB,MAAM,oBAAoB,gBAAgB,YAAiC;CACzE,MAAM,QAAQ,QAAQ,IAAI,aAAa;CACvC,MAAM,eAAe,UAAU,SAAS,eAAe;CACvD,MAAM,aAAa,iBAAiB,SAAS,QAAQ;CACrD,MAAM,cAAc,iBAAiB,SAAS,SAAS;AAEvD,QAAO;EACL,MAAM;EACN,SAAS;EAET,UAAU,IAAY;AACpB,OAAI,CAAC,WAAY,QAAO;AAExB,OAAI,OAAO,gBAAgB,OAAO,aAAa,OAAO,aACpD,QAAO;AAET,UAAO;;EAGT,iBAAiB,IAAY;AAC3B,OAAI,CAAC,YAAa,QAAO;AAEzB,UACE,iBAAiB,KAAK,GAAG,IACzB,sCAAsC,KAAK,GAAG,IAC9C,CAAC,GAAG,SAAS,eAAe;;EAIhC,UAAU,MAAc;AAEtB,OAAI,CAAC,YAAa,QAAO;AAEzB,OAAI,KAAK,SAAS,yBAAyB,CAAE,QAAO;AAEpD,UAAO,qCAAqC;;EAE/C;EACD;AAEF,MAAa,OAAO,kBAAkB;AACtC,MAAa,UAAU,kBAAkB;AACzC,MAAa,SAAS,kBAAkB;AACxC,MAAa,UAAU,kBAAkB;AACzC,MAAa,SAAS,kBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ait-co/devtools",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Development tools for Apps in Toss mini-apps — mock SDK, floating devtools panel, and universal bundler plugin",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=24"
|
|
8
|
+
},
|
|
6
9
|
"main": "./dist/mock/index.js",
|
|
7
10
|
"types": "./dist/mock/index.d.ts",
|
|
8
11
|
"exports": {
|
|
@@ -28,33 +31,38 @@
|
|
|
28
31
|
"dist"
|
|
29
32
|
],
|
|
30
33
|
"scripts": {
|
|
31
|
-
"build": "
|
|
32
|
-
"dev": "
|
|
33
|
-
"typecheck": "tsc --noEmit",
|
|
34
|
+
"build": "tsdown",
|
|
35
|
+
"dev": "tsdown --watch",
|
|
36
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p e2e/fixture/tsconfig.json",
|
|
34
37
|
"test": "vitest run",
|
|
35
38
|
"test:e2e": "playwright test",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
39
|
+
"lint": "biome check .",
|
|
40
|
+
"lint:fix": "biome check --write .",
|
|
41
|
+
"format": "biome format --write .",
|
|
42
|
+
"check-sdk-update": "tsx scripts/check-sdk-update.ts"
|
|
38
43
|
},
|
|
39
44
|
"peerDependencies": {
|
|
40
|
-
"@apps-in-toss/web-framework": "
|
|
45
|
+
"@apps-in-toss/web-framework": ">=2.4.0 <2.4.8"
|
|
41
46
|
},
|
|
42
47
|
"peerDependenciesMeta": {
|
|
43
48
|
"@apps-in-toss/web-framework": {
|
|
44
|
-
"optional":
|
|
49
|
+
"optional": false
|
|
45
50
|
}
|
|
46
51
|
},
|
|
47
52
|
"dependencies": {
|
|
48
|
-
"unplugin": "^
|
|
53
|
+
"unplugin": "^3.0.0"
|
|
49
54
|
},
|
|
50
55
|
"devDependencies": {
|
|
51
|
-
"@apps-in-toss/web-framework": "
|
|
56
|
+
"@apps-in-toss/web-framework": "2.4.7",
|
|
57
|
+
"@biomejs/biome": "2.4.12",
|
|
58
|
+
"@changesets/cli": "^2.31.0",
|
|
52
59
|
"@playwright/test": "^1.59.1",
|
|
53
60
|
"jsdom": "^29.0.2",
|
|
54
|
-
"
|
|
55
|
-
"tsx": "^4.
|
|
56
|
-
"typescript": "^
|
|
57
|
-
"
|
|
61
|
+
"tsdown": "^0.21.7",
|
|
62
|
+
"tsx": "^4.21.0",
|
|
63
|
+
"typescript": "^6.0.2",
|
|
64
|
+
"vite": "^8.0.8",
|
|
65
|
+
"vitest": "^4.1.4"
|
|
58
66
|
},
|
|
59
67
|
"keywords": [
|
|
60
68
|
"apps-in-toss",
|
|
@@ -64,7 +72,7 @@
|
|
|
64
72
|
"mock",
|
|
65
73
|
"sdk"
|
|
66
74
|
],
|
|
67
|
-
"packageManager": "pnpm@10.
|
|
75
|
+
"packageManager": "pnpm@10.33.0",
|
|
68
76
|
"license": "BSD-3-Clause",
|
|
69
77
|
"publishConfig": {
|
|
70
78
|
"access": "public"
|