Skip to content

Commit b7c9bbf

Browse files
Merge pull request #68 from davidmyersdev/fix-import-globals-with-trailing-slash
Fix import globals with trailing slash
2 parents c72c938 + 6b308e6 commit b7c9bbf

File tree

13 files changed

+611
-44
lines changed

13 files changed

+611
-44
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
- uses: ./.github/actions/install-dependencies
2929
- run: pnpm build:core
3030
- run: pnpm build:shims
31-
- run: pnpm build:banner
3231
- run: pnpm playwright install --with-deps
3332
- run: pnpm -r test
3433
test-unit:
@@ -40,7 +39,6 @@ jobs:
4039
- uses: ./.github/actions/install-dependencies
4140
- run: pnpm build:core
4241
- run: pnpm build:shims
43-
- run: pnpm build:banner
4442
- run: pnpm test:build
4543
typecheck:
4644
needs:
@@ -51,5 +49,4 @@ jobs:
5149
- uses: ./.github/actions/install-dependencies
5250
- run: pnpm build:core
5351
- run: pnpm build:shims
54-
- run: pnpm build:banner
5552
- run: pnpm typecheck

examples/vanilla/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"build": "vite build",
66
"dev": "vite",
77
"test": "CI=true run-p test:build test:dev",
8-
"test:build": "VITE_COMMAND=build WEB_SERVER_COMMAND='vite build && vite preview --port 5174' WEB_SERVER_URL='http://localhost:5174' playwright test",
9-
"test:dev": "VITE_COMMAND=dev WEB_SERVER_COMMAND='vite dev' WEB_SERVER_URL='http://localhost:5173' playwright test",
8+
"test:build": "VITE_COMMAND=build WEB_SERVER_COMMAND='vite build && vite preview --port 15174' WEB_SERVER_URL='http://localhost:15174' playwright test",
9+
"test:dev": "VITE_COMMAND=dev WEB_SERVER_COMMAND='vite dev --port 15173' WEB_SERVER_URL='http://localhost:15173' playwright test",
1010
"typecheck": "tsc"
1111
},
1212
"devDependencies": {

examples/vanilla/src/main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ const something = {
1414
},
1515
}
1616

17+
class Symbol {}
18+
1719
fs.writeFileSync('./test.txt', 'Hello from fs!', 'utf-8')
1820

21+
console.log(Symbol)
1922
console.log(fs)
2023
console.log(fetch)
2124
console.log(resolve('.'))

examples/vanilla/test/e2e/main.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ test('logs the correct values', async ({ page }) => {
2525

2626
if (isBuild) {
2727
expect(logs).toEqual([
28+
'class Symbol {\n }',
2829
'{Volume: , vol: Volume, createFsFromVolume: , fs: Object, memfs: }',
2930
'function fetch() { [native code] }',
3031
'/',
@@ -43,6 +44,7 @@ test('logs the correct values', async ({ page }) => {
4344
expect(logs).toEqual([
4445
'[vite] connecting...',
4546
'[vite] connected.',
47+
'class Symbol {\n}',
4648
'{Volume: , vol: _Volume, createFsFromVolume: , fs: Object, memfs: }',
4749
'function fetch() { [native code] }',
4850
'/',

package.json

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,29 @@
3131
"require": "./shims/dist/index.cjs",
3232
"import": "./shims/dist/index.js"
3333
},
34-
"./shims/banner": {
35-
"require": "./shims/banner/dist/index.cjs",
36-
"import": "./shims/banner/dist/index.js"
37-
},
3834
"./shims/buffer": {
3935
"require": "./shims/buffer/dist/index.cjs",
4036
"import": "./shims/buffer/dist/index.js"
4137
},
38+
"./shims/buffer/": {
39+
"require": "./shims/buffer/dist/index.cjs",
40+
"import": "./shims/buffer/dist/index.js"
41+
},
4242
"./shims/global": {
4343
"require": "./shims/global/dist/index.cjs",
4444
"import": "./shims/global/dist/index.js"
4545
},
46+
"./shims/global/": {
47+
"require": "./shims/global/dist/index.cjs",
48+
"import": "./shims/global/dist/index.js"
49+
},
4650
"./shims/process": {
4751
"require": "./shims/process/dist/index.cjs",
4852
"import": "./shims/process/dist/index.js"
53+
},
54+
"./shims/process/": {
55+
"require": "./shims/process/dist/index.cjs",
56+
"import": "./shims/process/dist/index.js"
4957
}
5058
},
5159
"main": "./dist/index.cjs",
@@ -56,8 +64,7 @@
5664
"shims"
5765
],
5866
"scripts": {
59-
"build": "run-s build:core build:shims build:banner build:types",
60-
"build:banner": "vite-node ./shims/banner/build.ts",
67+
"build": "run-s build:core build:shims build:types",
6168
"build:core": "vite build",
6269
"build:shims": "run-p build:shims:*",
6370
"build:shims:buffer": "vite build -c ./shims/vite.config.ts ./shims/buffer",
@@ -66,14 +73,15 @@
6673
"build:types": "run-s typecheck",
6774
"lint": "eslint .",
6875
"lint:fix": "eslint --fix .",
69-
"test": "run-s test:build",
76+
"test": "run-p test:build test:unit",
7077
"test:build": "run-p test:build:*",
7178
"test:build:react": "pnpm -C ./examples/react run build",
7279
"test:build:vanilla": "pnpm -C ./examples/vanilla run build",
7380
"test:build:vue": "pnpm -C ./examples/vue run build",
7481
"test:dev:react": "pnpm -C ./examples/react run dev",
7582
"test:dev:vanilla": "pnpm -C ./examples/vanilla run dev",
7683
"test:dev:vue": "pnpm -C ./examples/vue run dev",
84+
"test:unit": "vitest run --dir ./test",
7785
"typecheck": "run-p typecheck:*",
7886
"typecheck:core": "tsc",
7987
"typecheck:react": "pnpm -C ./examples/react run typecheck",
@@ -102,7 +110,8 @@
102110
"vite-node": "^0.34.6",
103111
"vite-plugin-externalize-deps": "^0.1.5",
104112
"vite-plugin-inspect": "^0.7.42",
105-
"vite-plugin-node-polyfills": "workspace:*"
113+
"vite-plugin-node-polyfills": "workspace:*",
114+
"vitest": "^1.1.0"
106115
},
107116
"publishConfig": {
108117
"access": "public"

0 commit comments

Comments
 (0)