Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23,820 changes: 23,692 additions & 128 deletions packages/action/dist/check.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions packages/action/dist/check.js.map

Large diffs are not rendered by default.

23,598 changes: 23,579 additions & 19 deletions packages/action/dist/index.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions packages/action/dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/action/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"main": "./dist/index.js",
"scripts": {
"build": "pnpm --filter @git-glimpse/core build && esbuild src/index.ts --bundle --platform=node --format=cjs --outfile=dist/index.js --external:@playwright/test --external:playwright-core --external:playwright --external:esbuild --sourcemap && esbuild src/check.ts --bundle --platform=node --format=cjs --outfile=dist/check.js --external:@playwright/test --external:playwright-core --external:playwright --external:esbuild --sourcemap",
"build": "pnpm --filter @git-glimpse/core build && esbuild src/index.ts --bundle --platform=node --format=cjs --outfile=dist/index.js --external:@playwright/test --external:playwright-core --external:playwright --sourcemap && esbuild src/check.ts --bundle --platform=node --format=cjs --outfile=dist/check.js --external:@playwright/test --external:playwright-core --external:playwright --sourcemap",
"typecheck": "tsc --noEmit"
},
"dependencies": {
Expand Down
12 changes: 7 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@
"types": "./dist/index.d.ts"
}
},
"files": ["dist"],
"files": [
"dist"
],
"scripts": {
"build": "tsc -p tsconfig.json",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@anthropic-ai/sdk": "^0.24.3",
"@playwright/test": "^1.44.0",
"@octokit/rest": "^20.1.1",
"esbuild": "^0.21.5",
"@playwright/test": "^1.44.0",
"minimatch": "^10.0.1",
"sucrase": "^3.35.1",
"zod": "^3.23.4"
},
"devDependencies": {
"@actions/artifact": "^2.1.11",
"@types/node": "^20.12.0",
"typescript": "^5.4.5",
"vitest": "^1.6.0",
"@types/node": "^20.12.0"
"vitest": "^1.6.0"
}
}
22 changes: 9 additions & 13 deletions packages/core/src/config/loader.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pathToFileURL } from 'node:url';
import { existsSync, writeFileSync, unlinkSync } from 'node:fs';
import { resolve, extname } from 'node:path';
import { existsSync, readFileSync, writeFileSync, unlinkSync } from 'node:fs';
import { resolve, dirname, extname } from 'node:path';
import { tmpdir } from 'node:os';
import { GitGlimpseConfigSchema, type GitGlimpseConfig } from './schema.js';
import { DEFAULT_RECORDING, DEFAULT_LLM, DEFAULT_TRIGGER } from './defaults.js';
Expand All @@ -11,19 +11,15 @@ async function importConfigFile(filePath: string): Promise<unknown> {
return mod.default ?? mod;
}

// Transpile .ts config via esbuild before importing
const { build } = await import('esbuild');
const result = await build({
entryPoints: [filePath],
bundle: true,
platform: 'node',
format: 'esm',
write: false,
});
// Transpile .ts config via sucrase (pure JS, fully bundleable, no native deps)
const { transform } = await import('sucrase');
const source = readFileSync(filePath, 'utf-8');
const { code } = transform(source, { transforms: ['typescript'] });

const tmpFile = resolve(tmpdir(), `git-glimpse-config-${Date.now()}.mjs`);
// Write next to the original so relative imports in the config resolve correctly
const tmpFile = resolve(dirname(filePath), `.git-glimpse-config-${Date.now()}.mjs`);
try {
writeFileSync(tmpFile, result.outputFiles[0].text);
writeFileSync(tmpFile, code);
const mod = await import(pathToFileURL(tmpFile).href);
return mod.default ?? mod;
} finally {
Expand Down
10 changes: 3 additions & 7 deletions packages/core/src/recorder/playwright-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,10 @@ async function executeScript(script: string, page: Page, _baseUrl: string): Prom
const { writeFileSync, unlinkSync } = await import('node:fs');
const { tmpdir } = await import('node:os');
const { pathToFileURL } = await import('node:url');
const { transformSync } = await import('esbuild');
const { transform } = await import('sucrase');

// Transpile TypeScript → ESM JavaScript via esbuild
const { code } = transformSync(script, {
loader: 'ts',
format: 'esm',
target: 'node20',
});
// Transpile TypeScript → ESM JavaScript via sucrase (pure JS, no native deps)
const { code } = transform(script, { transforms: ['typescript'] });

const tmpPath = join(tmpdir(), `git-glimpse-script-${Date.now()}.mjs`);
writeFileSync(tmpPath, code, 'utf-8');
Expand Down
128 changes: 125 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading