Skip to content

Commit

Permalink
Compile out BigInt polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
eyelidlessness committed Oct 16, 2023
1 parent 7b214ac commit ffdfc03
Show file tree
Hide file tree
Showing 3 changed files with 300 additions and 5 deletions.
5 changes: 4 additions & 1 deletion packages/odk-xpath/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@
"tree-sitter-xpath": "1.0.0-alpha.0"
},
"devDependencies": {
"@types/crypto-js": "^4.1.2",
"@babel/core": "^7.23.2",
"@playwright/test": "^1.38.1",
"@types/crypto-js": "^4.1.2",
"@vitest/browser": "^0.34.6",
"babel-plugin-transform-jsbi-to-bigint": "^1.4.0",
"jsdom": "^22.1.0",
"vite": "^4.4.11",
"vite-plugin-babel": "^1.1.3",
"vitest": "^0.34.6"
}
}
12 changes: 11 additions & 1 deletion packages/odk-xpath/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import { resolve as resolvePath } from 'node:path';
import { defineConfig } from 'vite';
import babel from 'vite-plugin-babel';
import type { CollectionValues } from './src/lib/collections/types';

const supportedBrowsers = new Set(['chromium', 'firefox', 'webkit'] as const);
Expand Down Expand Up @@ -62,7 +63,7 @@ export default defineConfig({
//
// The hard-coded values make tests difficult to reason about. The lack of
// testing around DST is a significant gap in test coverage.
TZ: JSON.stringify(process.env.TEST_TZ ?? 'America/Phoenix'),
TZ: JSON.stringify(process.env.TZ ?? 'America/Phoenix'),
RUNTIME_TARGET: JSON.stringify(RUNTIME_TARGET),
WASM_PATHS: JSON.stringify(WASM_PATHS),
},
Expand All @@ -77,6 +78,15 @@ export default defineConfig({
needsInterop: ['web-tree-sitter'],
force: true,
},
plugins: [
babel({
babelConfig: {
babelrc: false,
configFile: false,
plugins: ['transform-jsbi-to-bigint'],
},
}),
],
test: {
browser: {
enabled: BROWSER_ENABLED,
Expand Down
Loading

0 comments on commit ffdfc03

Please sign in to comment.