@code-yeongyu/senpi-codemode 2026.10.12 → 2026.10.13

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/CHANGELOG.md CHANGED
@@ -12,6 +12,20 @@
12
12
 
13
13
  ### Removed
14
14
 
15
+ ## [2026.10.13] - 2026-10-13
16
+
17
+ ### Breaking Changes
18
+
19
+ ### Added
20
+
21
+ ### Changed
22
+
23
+ ### Fixed
24
+
25
+ - Large JavaScript `eval` data cells no longer stall the shared RPC host on unnecessary import parsing. Cells without possible import syntax skip Babel, and the whole-AST walk runs only when a dynamic import is possible. The dynamic-import check stays linear on comment-heavy data; imports with comments or non-ASCII bindings still rewrite correctly ([#3206](https://github.com/code-yeongyu/senpi/pull/3206)).
26
+
27
+ ### Removed
28
+
15
29
  ## [2026.10.12] - 2026-10-12
16
30
 
17
31
  ### Breaking Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-yeongyu/senpi-codemode",
3
- "version": "2026.10.12",
3
+ "version": "2026.10.13",
4
4
  "description": "Source-only senpi extension package for codemode evaluation tools",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -33,15 +33,15 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/parser": "8.0.4",
36
- "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.10.12",
36
+ "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.10.13",
37
37
  "quickjs-wasi": "3.6.2",
38
38
  "typebox": "1.3.34"
39
39
  },
40
40
  "peerDependencies": {
41
- "@code-yeongyu/senpi": "2026.10.12"
41
+ "@code-yeongyu/senpi": "2026.10.13"
42
42
  },
43
43
  "devDependencies": {
44
- "@code-yeongyu/senpi": "2026.10.12"
44
+ "@code-yeongyu/senpi": "2026.10.13"
45
45
  },
46
46
  "keywords": [
47
47
  "senpi",
@@ -151,8 +151,16 @@ function applyEdits(code: string, edits: readonly TextEdit[]): string {
151
151
  return output;
152
152
  }
153
153
 
154
+ // Cells are prepared on the shared host loop (#3205), so Babel runs only for text that can be import syntax: the
155
+ // keyword as a whole word, not `import-1` or `import.meta`. Anything after it (comments, non-ASCII names) still
156
+ // parses; a false positive only costs a parse, a false negative would skip a rewrite. The AST walk runs when
157
+ // `import` is followed by `(` or by a comment that could hide one. The gate never scans a comment body: a
158
+ // comment-matching pattern backtracks quadratically on large data full of `import /*` text.
159
+ const IMPORT_SYNTAX = /\bimport\b(?![-.$])/u;
160
+ const DYNAMIC_IMPORT_SYNTAX = /\bimport\s*[(/]/u;
161
+
154
162
  export function rewriteImports(code: string): string {
155
- if (!code.includes("import")) return code;
163
+ if (!IMPORT_SYNTAX.test(code)) return code;
156
164
  const ast = parseProgram(code);
157
165
  if (!ast) return code;
158
166
  const edits: TextEdit[] = [];
@@ -161,9 +169,11 @@ export function rewriteImports(code: string): string {
161
169
  if (node.type !== "ImportDeclaration" || typeof node.start !== "number" || typeof node.end !== "number") continue;
162
170
  edits.push({ start: node.start, end: node.end, text: rewriteImportDeclaration(node) });
163
171
  }
164
- walkNodes(ast.program, (node) => {
165
- const edit = dynamicImportEdit(node);
166
- if (edit) edits.push(edit);
167
- });
172
+ if (DYNAMIC_IMPORT_SYNTAX.test(code)) {
173
+ walkNodes(ast.program, (node) => {
174
+ const edit = dynamicImportEdit(node);
175
+ if (edit) edits.push(edit);
176
+ });
177
+ }
168
178
  return applyEdits(code, edits);
169
179
  }