Skip to content

Commit

Permalink
prefixitems
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Feb 28, 2024
1 parent feed92f commit 193589a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 250 deletions.
5 changes: 3 additions & 2 deletions content/key-manager/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,9 @@ ${compiled}

case 'array':
if (value.type !== 'ArrayExpression') return fail(`expected array, got ${this.$typeof(value)} ${context}`)
if (!rule.items) return fail('cannot validate array items')
return `[${value.elements.map(v => this.validate(rule.items, v, context, softfail)).join(',')}]`
if (rule.items) return `[${value.elements.map(v => this.validate(rule.items, v, context, softfail)).join(',')}]`
if (rule.prefixItems) return `[${value.elements.map((v, i) => this.validate(rule.prefixItems[i], v, context, softfail)).join(',')}]`
return fail('cannot validate array items')

case 'template':
if (typeof value.value !== 'string') return fail(`expected string, got ${this.$typeof(value)} ${context}`)
Expand Down
248 changes: 0 additions & 248 deletions minitests/convert.js

This file was deleted.

24 changes: 24 additions & 0 deletions util/tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env node

const esbuild = require('esbuild')
const fs = require('fs')

const globals = `
const Zotero = {
platformMajorVersion: 0,
clientName: 'zotero',
};
`

let result = esbuild.buildSync({
entryPoints: [process.argv[2]],
bundle: true,
sourcemap: false,
write: false,
outdir: 'out',
banner: { js: globals },
})

for (let out of result.outputFiles) {
eval(out.text)
}

0 comments on commit 193589a

Please sign in to comment.