Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change import package #2373

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/standalone/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function standaloneCode(
// Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value
return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}`
}
return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}`
return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}module.exports.Ajv = ${n};${_n}${vCode}`
}

function multiExportsCode<T extends SchemaEnv | string>(
Expand Down
1 change: 1 addition & 0 deletions spec/ajv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ const AjvClass: typeof Ajv = typeof window == "object" ? (window as any).ajv7 :

export default AjvClass
module.exports = AjvClass
module.exports.Ajv = AjvClass
module.exports.default = AjvClass
1 change: 1 addition & 0 deletions spec/ajv2019.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ const AjvClass: typeof Ajv2019 =

export default AjvClass
module.exports = AjvClass
module.exports.Ajv = AjvClass
module.exports.default = AjvClass
1 change: 1 addition & 0 deletions spec/ajv2020.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ const AjvClass: typeof Ajv2020 =

export default AjvClass
module.exports = AjvClass
module.exports.Ajv = AjvClass
module.exports.default = AjvClass
1 change: 1 addition & 0 deletions spec/ajv_jtd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ const AjvClass: typeof AjvJTD =

export default AjvClass
module.exports = AjvClass
module.exports.Ajv = AjvClass
module.exports.default = AjvClass
1 change: 1 addition & 0 deletions spec/standalone.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ describe("standalone code generation", () => {
testExportTypeCjs(moduleCode, true)
const m = requireFromString(moduleCode)
testExport(m)
testExport(m.Ajv)
testExport(m.default)

function testExport(validate: AnyValidateFunction<unknown>) {
Expand Down