Skip to content

Commit

Permalink
Don't bundle github-reserved-names (switch to esbuild) (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante authored Jun 28, 2024
1 parent 5debfba commit 4818df0
Show file tree
Hide file tree
Showing 8 changed files with 659 additions and 225 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/esm-lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
env:
IMPORT_STATEMENT: import * as pageDetect from "github-url-detection"
IMPORT_STATEMENT: export * as pageDetect from "github-url-detection"

# FILE GENERATED WITH: npx ghat fregante/ghatemplates/esm-lint
# SOURCE: https://github.com/fregante/ghatemplates
Expand Down Expand Up @@ -58,9 +58,9 @@ jobs:
needs: Pack
steps:
- uses: actions/download-artifact@v4
- run: npm install --omit=dev ./artifact rollup@2 @rollup/plugin-node-resolve
- run: npm install --omit=dev ./artifact rollup@4 @rollup/plugin-json @rollup/plugin-node-resolve
- run: echo "$IMPORT_STATEMENT" > index.js
- run: npx rollup -p node-resolve index.js
- run: npx rollup -p node-resolve -p @rollup/plugin-json index.js
Vite:
runs-on: ubuntu-latest
needs: Pack
Expand All @@ -84,6 +84,7 @@ jobs:
needs: Pack
steps:
- uses: actions/download-artifact@v4
- run: echo '{"type":"module"}' > package.json
- run: npm install --omit=dev ./artifact @sindresorhus/tsconfig
- run: echo "$IMPORT_STATEMENT" > index.ts
- run: >
Expand Down
4 changes: 1 addition & 3 deletions collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
export const testableUrls = new Map<string, string[]>();

export function addTests(test: string, urls: string[]): void {
if (import.meta.vitest) {
testableUrls.set(test, urls);
}
TEST: testableUrls.set(test, urls);
}

export function getTests(detectName: string): string[] {
Expand Down
4 changes: 0 additions & 4 deletions demo/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@ export default defineConfig({
},
},
},
define: {
// eslint-disable-next-line @typescript-eslint/naming-convention -- no.
'import.meta.vitest': '"no vitest here, but I need the URLs"',
},
});
4 changes: 0 additions & 4 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/* eslint-disable @typescript-eslint/consistent-type-definitions -- Module augmentation */

interface ImportMeta {
readonly vitest: unknown;
}

// Broaden types because testing against `"undefined"` is fine for our regexes
interface RegExp {
test(s: string | undefined): boolean;
Expand Down
180 changes: 90 additions & 90 deletions index.ts

Large diffs are not rendered by default.

Loading

0 comments on commit 4818df0

Please sign in to comment.