Skip to content

Commit

Permalink
Merge pull request #183 from iambumblehead/use-export-esmock.js
Browse files Browse the repository at this point in the history
Use export esmock.js
  • Loading branch information
iambumblehead authored Oct 26, 2022
2 parents d271dfd + a64e70b commit 4aed43b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# changelog

* 2.0.7 _Oct.20.2022_
* 2.0.7 _Oct.26.2022_
* [use export esmock.js,](https://github.com/iambumblehead/esmock/pull/182) rather than esmockLoader.js, as main package export
* [embed resolvewithplus inside esmock,](https://github.com/iambumblehead/esmock/pull/181) to support yarn PnP, per @koshic
* [use loader mechanism to detect](https://github.com/iambumblehead/esmock/pull/180) presence of esmock loader
* [detect and use import.meta.resolve,](https://github.com/iambumblehead/esmock/pull/179) when defined by host environment
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"readmeFilename": "README.md",
"description": "provides native ESM import mocking for unit tests",
"author": "chris <[email protected]>",
"main": "./src/esmockLoader.js",
"main": "./src/esmock.js",
"exports": {
"types": "./src/esmock.d.ts",
"import": "./src/esmockLoader.js"
"import": "./src/esmock.js"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -76,6 +76,8 @@
"lint": "eslint --ext=.js,.mjs .",
"lint-fix": "eslint --ext=.js,.mjs --fix .",
"mini:pkg": "npm pkg delete scripts devDependencies dependencies",
"prepublishOnly": "npm run lint && npm run test-ci && npm run mini:pkg"
"mini:src": "cd src && npx rimraf \"!(esmock).js\"",
"mini": "npm run mini:pkg && npm run mini:src",
"prepublishOnly": "npm run lint && npm run test-ci && npm run mini"
}
}
1 change: 1 addition & 0 deletions src/esmock.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ const esmock = Object.assign(esmockGo(), {
purge, p: esmockGo({ purge: false }), strict, strictest })

export {esmock as default, strict, strictest}
export * from './esmockLoader.js'
2 changes: 0 additions & 2 deletions src/esmockLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,4 @@ const load = async (url, context, nextLoad) => {
// node lt 16.12 require getSource, node gte 16.12 warn remove getSource
const getSource = isLT1612 && load

export * from './esmock.js'
export {default} from './esmock.js'
export {load, resolve, getSource, loaderIsVerified}
2 changes: 1 addition & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"babelGeneratedDoubleDefault": "file:./local/babelGeneratedDoubleDefault"
},
"scripts": {
"mini": "cd .. && cd src && npx esbuild esmockLoader.js --minify --bundle --allow-overwrite --platform=node --format=esm --outfile=esmockLoader.js",
"mini": "cd .. && cd src && npx esbuild esmock.js --minify --bundle --allow-overwrite --platform=node --format=esm --outfile=esmock.js",
"isnodelt18": "node -e \"+process.versions.node.split('.')[0] < 18 || process.exit(1)\"",
"install:esmock": "cd .. && npm install",
"install:test-ava": "cd tests-ava && npm install",
Expand Down
4 changes: 2 additions & 2 deletions tests/package.json.esmock.export.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from '../src/esmockLoader.js'
export {default} from '../src/esmockLoader.js'
export * from '../src/esmock.js'
export {default} from '../src/esmock.js'

// this file is used in tandem with two other things,
//
Expand Down

0 comments on commit 4aed43b

Please sign in to comment.