@inspecto-dev/cli 0.2.0-alpha.4 → 0.2.0-alpha.5
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/.turbo/turbo-build.log +5 -5
- package/.turbo/turbo-test.log +16 -21
- package/CHANGELOG.md +6 -0
- package/dist/bin.js +1 -1
- package/dist/{chunk-EUCQCD3Y.js → chunk-MIHQGC3L.js} +20 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/inject/ast-injector.ts +18 -7
- package/src/inject/strategies/vite.ts +2 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @inspecto-dev/cli@0.2.0-alpha.
|
|
3
|
+
> @inspecto-dev/cli@0.2.0-alpha.4 build /Users/bytedance/Works/hugo.felix/inspecto/packages/cli
|
|
4
4
|
> tsup
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/bin.ts, src/index.ts
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
[34mCLI[39m Target: node18
|
|
11
11
|
[34mCLI[39m Cleaning output folder
|
|
12
12
|
[34mESM[39m Build start
|
|
13
|
-
[32mESM[39m [1mdist/
|
|
14
|
-
[32mESM[39m [1mdist/chunk-EUCQCD3Y.js [22m[32m57.56 KB[39m
|
|
13
|
+
[32mESM[39m [1mdist/chunk-MIHQGC3L.js [22m[32m58.03 KB[39m
|
|
15
14
|
[32mESM[39m [1mdist/bin.js [22m[32m2.64 KB[39m
|
|
16
|
-
[32mESM[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.js [22m[32m109.00 B[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 32ms
|
|
17
17
|
DTS Build start
|
|
18
|
-
DTS ⚡️ Build success in
|
|
18
|
+
DTS ⚡️ Build success in 1096ms
|
|
19
19
|
DTS dist/bin.d.ts 13.00 B
|
|
20
20
|
DTS dist/index.d.ts 1.18 KB
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
[2m Tests [22m [1m[32m13 passed[39m[22m[90m (13)[39m
|
|
18
|
-
[2m Start at [22m 11:27:40
|
|
19
|
-
[2m Duration [22m 548ms[2m (transform 85ms, setup 0ms, collect 131ms, tests 15ms, environment 0ms, prepare 374ms)[22m
|
|
20
|
-
|
|
21
|
-
[?25h[?25h
|
|
1
|
+
|
|
2
|
+
> @inspecto-dev/cli@0.2.0-alpha.4 test /Users/bytedance/Works/hugo.felix/inspecto/packages/cli
|
|
3
|
+
> vitest run --passWithNoTests
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
RUN v1.6.1 /Users/bytedance/Works/hugo.felix/inspecto/packages/cli
|
|
7
|
+
|
|
8
|
+
✓ tests/framework.test.ts (5 tests) 4ms
|
|
9
|
+
✓ tests/build-tool.test.ts (2 tests) 9ms
|
|
10
|
+
✓ tests/ide.test.ts (6 tests) 8ms
|
|
11
|
+
|
|
12
|
+
Test Files 3 passed (3)
|
|
13
|
+
Tests 13 passed (13)
|
|
14
|
+
Start at 15:41:01
|
|
15
|
+
Duration 771ms (transform 133ms, setup 1ms, collect 221ms, tests 21ms, environment 0ms, prepare 367ms)
|
|
16
|
+
|
package/CHANGELOG.md
CHANGED
package/dist/bin.js
CHANGED
|
@@ -626,7 +626,8 @@ var ViteStrategy = class {
|
|
|
626
626
|
inject({ mod, detection }) {
|
|
627
627
|
addVitePlugin(mod, {
|
|
628
628
|
from: "@inspecto-dev/plugin",
|
|
629
|
-
constructor: "
|
|
629
|
+
constructor: "inspecto",
|
|
630
|
+
imported: "vitePlugin"
|
|
630
631
|
});
|
|
631
632
|
}
|
|
632
633
|
getManualInstructions(detection, reason) {
|
|
@@ -808,8 +809,21 @@ function printManualInstructions(strategy, detection, reason) {
|
|
|
808
809
|
}
|
|
809
810
|
}
|
|
810
811
|
function isAlreadyInjected(content) {
|
|
811
|
-
|
|
812
|
-
/
|
|
812
|
+
const normalized = content.replace(/\s+/g, " ");
|
|
813
|
+
const importPlugin = /import\s+(.+?)\s+from\s+['"]@inspecto-dev\/plugin['"]/g;
|
|
814
|
+
const requirePlugin = /require\(['"]@inspecto-dev\/plugin['"]\)/;
|
|
815
|
+
const legacyImport = /import\s+.*ai-dev-inspector/.test(normalized);
|
|
816
|
+
const legacyRequire = /require\(['"]ai-dev-inspector['"]\)/.test(normalized);
|
|
817
|
+
if (legacyImport || legacyRequire || requirePlugin.test(normalized)) return true;
|
|
818
|
+
let match;
|
|
819
|
+
importPlugin.lastIndex = 0;
|
|
820
|
+
while (match = importPlugin.exec(normalized)) {
|
|
821
|
+
const importClause = match[1] || "";
|
|
822
|
+
if (/inspecto/.test(importClause) || /vitePlugin/.test(importClause)) {
|
|
823
|
+
return true;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
return false;
|
|
813
827
|
}
|
|
814
828
|
async function injectPlugin(root, detection, dryRun) {
|
|
815
829
|
const configPath = path7.join(root, detection.configPath);
|
|
@@ -1219,7 +1233,9 @@ async function init(options) {
|
|
|
1219
1233
|
}
|
|
1220
1234
|
let manualConfigRequiredFor = "";
|
|
1221
1235
|
if (verifiedPackages.length > 0 && buildResult.supported.length === 0) {
|
|
1222
|
-
log.warn(
|
|
1236
|
+
log.warn(
|
|
1237
|
+
`No supported build configs detected for: ${verifiedPackages.map((pkg) => pkg ? pkg : ".").join(", ")}`
|
|
1238
|
+
);
|
|
1223
1239
|
log.hint("Double-check the --packages values or run without the flag to scan the repo root");
|
|
1224
1240
|
}
|
|
1225
1241
|
if (buildResult.supported.length > 0) {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -41,13 +41,24 @@ function printManualInstructions(
|
|
|
41
41
|
|
|
42
42
|
/** Check if inspecto is already injected (idempotency). */
|
|
43
43
|
function isAlreadyInjected(content: string): boolean {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
44
|
+
const normalized = content.replace(/\s+/g, ' ')
|
|
45
|
+
const importPlugin = /import\s+(.+?)\s+from\s+['"]@inspecto-dev\/plugin['"]/g
|
|
46
|
+
const requirePlugin = /require\(['"]@inspecto-dev\/plugin['"]\)/
|
|
47
|
+
const legacyImport = /import\s+.*ai-dev-inspector/.test(normalized)
|
|
48
|
+
const legacyRequire = /require\(['"]ai-dev-inspector['"]\)/.test(normalized)
|
|
49
|
+
|
|
50
|
+
if (legacyImport || legacyRequire || requirePlugin.test(normalized)) return true
|
|
51
|
+
|
|
52
|
+
let match: RegExpExecArray | null
|
|
53
|
+
importPlugin.lastIndex = 0
|
|
54
|
+
while ((match = importPlugin.exec(normalized))) {
|
|
55
|
+
const importClause = match[1] || ''
|
|
56
|
+
if (/inspecto/.test(importClause) || /vitePlugin/.test(importClause)) {
|
|
57
|
+
return true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return false
|
|
51
62
|
}
|
|
52
63
|
|
|
53
64
|
// ---- Main injection orchestrator ----
|
|
@@ -12,7 +12,8 @@ export class ViteStrategy implements InjectStrategy {
|
|
|
12
12
|
inject({ mod, detection }: InjectOptions): void {
|
|
13
13
|
addVitePlugin(mod, {
|
|
14
14
|
from: '@inspecto-dev/plugin',
|
|
15
|
-
constructor: '
|
|
15
|
+
constructor: 'inspecto',
|
|
16
|
+
imported: 'vitePlugin',
|
|
16
17
|
})
|
|
17
18
|
}
|
|
18
19
|
|