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
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 {
Copy link
Member Author

@fregante fregante Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tried many variations of --pure and --define. I wasn't able to drop this addTests helper from the source, it's needed to enable the tree-shaking

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