-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from embroider-build/NullVoxPopuli-patch-1
Allow direct importing of the standalone module
- Loading branch information
Showing
9 changed files
with
4,305 additions
and
665 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,16 @@ | ||
/** | ||
* This type is deliberately wrong. | ||
* | ||
* To require use: | ||
* - require('content-tag') | ||
* | ||
* To import: | ||
* - import 'content-tag'; | ||
* - import 'content-tag/standalone'; | ||
* - import('content-tag'); | ||
* - import('content-tag/standalone'); | ||
*/ | ||
class Preprocessor {} | ||
|
||
module.exports = { Preprocessor }; | ||
|
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,14 @@ | ||
/** | ||
* Not all our entrypoints support all environments. | ||
* | ||
* This stub file is to appears are-the-types-wrong, but also give developers in require / CJS environments | ||
* more useful information when they try to require an ESM | ||
*/ | ||
class Preprocessor { | ||
constructor() { | ||
throw new Error(`Tried to create a Preprocessor using require() when an import was expected. Please change to using import.`); | ||
} | ||
} | ||
|
||
|
||
module.exports = { Preprocessor }; |
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,11 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
|
||
|
||
describe('package.json#export aliases', () => { | ||
it(`'.' === './standalone' when importing`, async () => { | ||
let main = await import('content-tag'); | ||
let standalone = await import('content-tag/standalone'); | ||
|
||
expect(main.Preprocessor).to.equal(standalone.Preprocessor); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,20 @@ | ||
import { defineConfig } from 'vite'; | ||
/** | ||
* Browser-only vitest config. | ||
* We're currently using Mocha for node testing. | ||
*/ | ||
export default defineConfig({ | ||
test: { | ||
include: ['test/browser/**/*'], | ||
browser: { | ||
name: 'chrome', | ||
headless: true, | ||
provider: 'webdriverio', | ||
providerOptions: { | ||
launch: { | ||
devtools: false, | ||
} | ||
} | ||
} | ||
} | ||
}) |