-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
85 additions
and
27 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
packages/knip/fixtures/cli-preprocessor/node_modules/@org/preprocessor/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
packages/knip/fixtures/cli-reporter/node_modules/@org/reporter/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "@fixtures/load-cjs", | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SyntaxError: Cannot use 'import.meta' outside a module | ||
|
||
import.meta; | ||
import.meta.resolve; | ||
import.meta.url; | ||
|
||
// SyntaxError: Unexpected identifier 'Promise' | ||
|
||
Promise; | ||
|
||
// TypeError: Reflect.metadata is not a function | ||
|
||
function meow(target: unknown, _: unknown) {} | ||
|
||
@meow | ||
export class Cat { | ||
constructor() {} | ||
} | ||
|
||
// SyntaxError: await is only valid in async functions and the top level bodies of modules | ||
|
||
await Promise.resolve('TLA'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "@fixtures/load-esm-ts", | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "esnext", | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details. | ||
|
||
// SyntaxError: Cannot use 'import.meta' outside a module | ||
|
||
import.meta; | ||
import.meta.resolve; | ||
import.meta.url; | ||
|
||
// SyntaxError: await is only valid in async functions and the top level bodies of modules | ||
|
||
// SyntaxError: missing ) after argument list | ||
|
||
// SyntaxError: Unexpected identifier 'Promise' | ||
Promise; | ||
|
||
// Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in [...]/node_modules/estree-walker/package.json | ||
|
||
await Promise.resolve('TLA'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "@fixtures/load-esm", | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { test } from 'bun:test'; | ||
import assert from 'node:assert/strict'; | ||
import { _load as load } from '../../src/util/loader.js'; | ||
import { join, resolve } from '../../src/util/path.js'; | ||
|
||
test('Should load modules (CommonJS)', async () => { | ||
const cwd = resolve('fixtures/load-cjs'); | ||
await assert.doesNotReject(load(join(cwd, 'index.js'))); | ||
}); | ||
|
||
test('Should load modules (ESM)', async () => { | ||
const cwd = resolve('fixtures/load-esm'); | ||
await assert.doesNotReject(load(join(cwd, 'index.js'))); | ||
}); | ||
|
||
test('Should load modules (ESM/TS)', async () => { | ||
const cwd = resolve('fixtures/load-esm-ts'); | ||
await assert.doesNotReject(load(join(cwd, 'index.ts'))); | ||
}); |