-
-
Notifications
You must be signed in to change notification settings - Fork 120
feat(common): precompile ajv schemas 🎺 #9691
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
Merged
mcdurdin
merged 3 commits into
epic/package-metadata
from
feat/common/9640-precompile-schemas
Oct 6, 2023
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
src/schemas/ | ||
src/schemas/ | ||
obj/ |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,25 @@ | ||
import kpj from './schemas/kpj.schema.validator.mjs'; | ||
import kpj90 from './schemas/kpj-9.0.schema.validator.mjs'; | ||
import kvks from './schemas/kvks.schema.validator.mjs'; | ||
import ldmlKeyboard3 from './schemas/ldml-keyboard3.schema.validator.mjs'; | ||
import ldmlKeyboardTest3 from './schemas/ldml-keyboardtest3.schema.validator.mjs'; | ||
import displayMap from './schemas/displaymap.schema.validator.mjs'; | ||
import touchLayoutClean from './schemas/keyman-touch-layout.clean.spec.validator.mjs'; | ||
import touchLayout from './schemas/keyman-touch-layout.spec.validator.mjs'; | ||
import keyboard_info from './schemas/keyboard_info.schema.validator.mjs'; | ||
|
||
// How to use: https://ajv.js.org/standalone.html#using-the-validation-function-s | ||
// See also existing uses (search for `SchemaValidators`) for examples. | ||
const SchemaValidators = { | ||
kpj, | ||
kpj90, | ||
kvks, | ||
ldmlKeyboard3, | ||
ldmlKeyboardTest3, | ||
displayMap, | ||
touchLayoutClean, | ||
touchLayout, | ||
keyboard_info, | ||
}; | ||
mcdurdin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export default SchemaValidators; |
This file contains hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
/* | ||
* This somewhat peculiar function is used in `build.sh configure` when | ||
* precompiling the validators and makes it possible to use the extended formats | ||
* in ajv-formats. | ||
*/ | ||
function formats(ajv) { | ||
require("ajv-formats")(ajv); | ||
} | ||
|
||
module.exports = formats; |
This file contains hidden or 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,27 @@ | ||
/* | ||
* Bundle schema validation files (from .cjs) and make them available as ES modules | ||
*/ | ||
|
||
import esbuild from 'esbuild'; | ||
|
||
await esbuild.build({ | ||
entryPoints: [ | ||
'obj/schemas/kpj.schema.validator.cjs', | ||
'obj/schemas/kpj-9.0.schema.validator.cjs', | ||
'obj/schemas/kvks.schema.validator.cjs', | ||
'obj/schemas/ldml-keyboard3.schema.validator.cjs', | ||
'obj/schemas/ldml-keyboardtest3.schema.validator.cjs', | ||
'obj/schemas/displaymap.schema.validator.cjs', | ||
'obj/schemas/keyman-touch-layout.clean.spec.validator.cjs', | ||
'obj/schemas/keyman-touch-layout.spec.validator.cjs', | ||
'obj/schemas/keyboard_info.schema.validator.cjs', | ||
], | ||
bundle: true, | ||
format: 'esm', | ||
target: 'es2022', | ||
outdir: 'src/schemas/', | ||
sourcemap: false, | ||
|
||
// We want a .mjs extension to force node into ESM module mode | ||
outExtension: { '.js': '.mjs' }, | ||
}); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.