enketo-transformer
Advanced tools
Comparing version 3.0.1 to 4.0.0
@@ -6,2 +6,7 @@ ## Change Log | ||
## [4.0.0] - 2023-10-30 | ||
- Breaking change: Support Node 18 and 20, drop support for older versions | ||
- Breaking change: Remove outdated Vagrantfile | ||
## [3.0.1] - 2023-08-18 | ||
@@ -8,0 +13,0 @@ |
@@ -19,3 +19,2 @@ import "./dom/node/Document.js"; | ||
}; | ||
const isFunction = (value) => typeof value === "function"; | ||
const transform = async (survey) => { | ||
@@ -33,3 +32,3 @@ const { xform, markdown, media, openclinica, theme } = survey; | ||
const preprocess = getPreprocess(survey); | ||
if (isFunction(preprocess)) { | ||
if (typeof preprocess === "function") { | ||
const { libxmljs } = await import("libxslt"); | ||
@@ -64,3 +63,3 @@ xformDoc = preprocess.call(libxmljs, xformDoc); | ||
languageMap, | ||
transformerVersion: "3.0.1" | ||
transformerVersion: "4.0.0" | ||
}); | ||
@@ -348,3 +347,3 @@ }; | ||
}; | ||
const version = "7249d3de7986e03785f084296e62ab0e"; | ||
const version = "bfd32a8b6158db4a7d91b55d4bff1c11"; | ||
const sheets = { | ||
@@ -356,3 +355,3 @@ xslForm, | ||
transform, | ||
version: "7249d3de7986e03785f084296e62ab0e", | ||
version: "bfd32a8b6158db4a7d91b55d4bff1c11", | ||
NAMESPACES, | ||
@@ -359,0 +358,0 @@ sheets, |
@@ -19,3 +19,3 @@ import type LibXMLJS from 'libxmljs'; | ||
} | ||
export type TransformedSurvey<T = any> = Omit<T, keyof Survey> & { | ||
export type TransformedSurvey<T = unknown> = Omit<T, keyof Survey> & { | ||
form: string; | ||
@@ -22,0 +22,0 @@ languageMap: Record<string, string>; |
@@ -9,4 +9,4 @@ import type { Document } from 'libxmljs'; | ||
reset(): void; | ||
setParameter(_namespaceURI: string | null, name: string, value: any): void; | ||
setParameter(_namespaceURI: string | null, name: string, value: unknown): void; | ||
transformToDocument(xmlDoc: DOM.Document): Document; | ||
} |
@@ -19,3 +19,3 @@ import type LibXMLJS from 'libxmljs'; | ||
} | ||
export type TransformedSurvey<T = any> = Omit<T, keyof Survey> & { | ||
export type TransformedSurvey<T = unknown> = Omit<T, keyof Survey> & { | ||
form: string; | ||
@@ -22,0 +22,0 @@ languageMap: Record<string, string>; |
{ | ||
"name": "enketo-transformer", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"description": "Library that transforms ODK-compliant XForms into a format that Enketo can consume", | ||
@@ -49,18 +49,11 @@ "license": "Apache-2.0", | ||
}, | ||
"engines": { | ||
"node": ">=14 <17", | ||
"npm": ">=6 <7" | ||
}, | ||
"contributors": [], | ||
"scripts": { | ||
"benchmarks": "vite-node ./test/benchmarks.ts", | ||
"build": "EMPTY_OUT_DIR=true vite build && ENV=web vite build && npm run tsc", | ||
"prepare": "npm run build", | ||
"start": "vite-node ./src/app.ts", | ||
"eslint-check": "eslint src/**/*.ts vite.config.ts test/**/*.ts", | ||
"eslint-fix": "eslint src/**/*.ts vite.config.ts test/**/*.ts --fix", | ||
"prettier-fix": "prettier --write .", | ||
"test": "vitest run --coverage && npm run prettier-fix && npm run eslint-fix && npm run tsc && node update-readme-with-shield-badge.cjs", | ||
"build": "EMPTY_OUT_DIR=true vite build && ENV=web vite build && yarn tsc && echo 'enketo-transformer build complete'", | ||
"prepare": "yarn build", | ||
"test": "vitest run --coverage && yarn tsc && node update-readme-with-shield-badge.cjs", | ||
"test:watch": "vitest", | ||
"test:watch:web": "ENV=web vitest", | ||
"test:web": "ENV=web vitest run", | ||
"develop": "DEBUG=api,transformer,markdown,language vite-node ./src/app.ts & http-server test/forms -p 8081", | ||
@@ -87,3 +80,2 @@ "tsc": "tsc --project ./tsconfig.json && tsc --project ./tsconfig.web.json && tsc --project ./test/tsconfig.json" | ||
"linkedom": "^0.14.26", | ||
"prettier": "^2.8.8", | ||
"string-direction": "0.1.x", | ||
@@ -94,41 +86,11 @@ "undici": "^5.23.0", | ||
"devDependencies": { | ||
"@prettier/plugin-xml": "^2.2.0", | ||
"@prettier/sync": "^0.3.0", | ||
"@prettier/plugin-xml": "^3.2.0", | ||
"@types/benchmark": "^2.1.2", | ||
"@types/css.escape": "^1.5.0", | ||
"@types/express": "^4.17.17", | ||
"@types/node": "^18.17.5", | ||
"@types/prettier": "^2.7.3", | ||
"@typescript-eslint/eslint-plugin": "^5.62.0", | ||
"@typescript-eslint/parser": "^5.62.0", | ||
"@vitest/coverage-istanbul": "^0.28.5", | ||
"@types/prettier": "^3.0.0", | ||
"benchmark": "^2.1.4", | ||
"chai": "^4.3.7", | ||
"chai-as-promised": "^7.1.1", | ||
"docdash": "^1.2.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-prettier": "^8.10.0", | ||
"eslint-plugin-chai-friendly": "^0.7.2", | ||
"eslint-plugin-import": "^2.28.0", | ||
"eslint-plugin-jsdoc": "^36.1.1", | ||
"eslint-plugin-jsx-a11y": "^6.7.1", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-react": "^7.33.2", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-unicorn": "^40.1.0", | ||
"eslint-plugin-vitest": "0.0.21", | ||
"grunt": "^1.6.1", | ||
"http-server": "^13.1.0", | ||
"istanbul-reporter-shield-badge": "^1.2.1", | ||
"libxslt": "0.10.2", | ||
"markdown-eslint-parser": "^1.2.1", | ||
"microtime": "^3.1.1", | ||
"playwright": "1.25.0", | ||
"pretty-format": "^29.6.2", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^5.1.6", | ||
"vite": "^4.4.9", | ||
"vite-node": "^0.28.5", | ||
"vite-plugin-node": "^1.0.0", | ||
"vitest": "^0.28.5" | ||
"pretty-format": "^29.6.2" | ||
}, | ||
@@ -143,6 +105,16 @@ "peerDependencies": { | ||
}, | ||
"resolutions": { | ||
"nan": "^2.17.0", | ||
"libxslt/nan": "^2.17.0", | ||
"node1-libxmljsmt-myh/nan": "^2.17.0" | ||
}, | ||
"engines": { | ||
"node": ">=18 <21", | ||
"npm": "please-use-yarn", | ||
"yarn": ">= 1.22.19 <2" | ||
}, | ||
"volta": { | ||
"node": "16.5.0", | ||
"npm": "6.14.13" | ||
"node": "20.5.1", | ||
"yarn": "1.22.19" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
 | ||
 | ||
[](http://badge.fury.io/js/enketo-transformer) | ||
@@ -10,3 +10,3 @@ | ||
Enketo Transformer is maintained by [the ODK team](https://getodk.org/about/team.html) (primarily [Trevor Schmidt](https://github.com/eyelidlessness/)). Broader context is available in [the Enketo Express repository](https://github.com/enketo/enketo-express#project-status). | ||
Enketo Transformer is maintained by [the ODK team](https://getodk.org/about/team.html) (primarily [Trevor Schmidt](https://github.com/eyelidlessness/)). Broader context is available at [the toplevel](https://github.com/enketo/enketo#project-status). | ||
@@ -40,3 +40,3 @@ ODK XForms are based off of [W3C XForms](https://en.wikipedia.org/wiki/XForms) which were originally intended to be supported natively by web browsers. Browser support did not happen and the ODK standard drifted too far from the W3C standard to have used it anyway. Enketo chose to transform XForms to HTML5 forms before rendering them. Enketo Transformer performs this work by applying an XSL transform followed by a few post-processing steps in Javascript. This was time-consuming for forms with certain characteristics so the transformation was designed to happen on the backend so it could be cached across client requests. | ||
- Node.js 16 and npm 6 (Node.js 14 is also supported) | ||
- Node.js 20 and Yarn 1 (Node.js 16 and 18 are also supported) | ||
- [Volta](https://volta.sh/) is recommended for development | ||
@@ -54,4 +54,4 @@ - For Node/server-side transforms: | ||
cd ./demo | ||
npm install | ||
npm run demo | ||
yarn install | ||
yarn run demo | ||
``` | ||
@@ -123,3 +123,3 @@ | ||
```sh | ||
npm install | ||
yarn install | ||
``` | ||
@@ -132,3 +132,3 @@ | ||
```sh | ||
npm start | ||
yarn start | ||
``` | ||
@@ -166,3 +166,3 @@ | ||
The script `npm run develop` runs the app on port 8085 and also serves test/forms on port 8081. You could test the transformation output by placing an XForm in test/forms and running | ||
The script `yarn run develop` runs the app on port 8085 and also serves test/forms on port 8081. You could test the transformation output by placing an XForm in test/forms and running | ||
http://localhost:8085/transform?xform=http://localhost:8081/autocomplete.xml | ||
@@ -173,3 +173,3 @@ | ||
A vagrant configuration file and provisioning script is also included. Use DEBUG environment variable to see debug terminal output, e.g.: | ||
You may use the `DEBUG` environment variable to see debug terminal output, e.g.: | ||
@@ -182,5 +182,4 @@ ```bash | ||
- run tests with `npm test` | ||
- run tests in watch mode with `npm run test:watch` | ||
- Tests can be run in watch mode for [TDD](https://en.wikipedia.org/wiki/Test-driven_development) workflows with `npm run test-watch`, and support for debugging in [VSCode](https://code.visualstudio.com/) is provided. For instructions see [./#debugging-test-watch-mode-in-vscode](Debugging test watch mode in VSCode) below | ||
- run tests with `yarn test` | ||
- Tests can be run in watch mode for [TDD](https://en.wikipedia.org/wiki/Test-driven_development) workflows with `yarn run test:watch`, and support for debugging in [VSCode](https://code.visualstudio.com/) is provided. For instructions see [./#debugging-test-watch-mode-in-vscode](Debugging test watch mode in VSCode) below | ||
@@ -201,22 +200,2 @@ #### Debugging test watch mode in VSCode | ||
## Release | ||
Releases are done each time a dependent tool needs an `enketo-transformer` change. | ||
1. Create release PR | ||
1. Update `CHANGELOG.md` | ||
1. Update version in `package.json` | ||
- Bump to major version if downstream has to make changes. | ||
1. Check [Dependabot](https://github.com/enketo/enketo-transformer/security/dependabot) for alerts | ||
1. Run `npm update` | ||
- Check if `node-libxslt` has been updated because it has caused problems in the past | ||
1. Run `npm audit` | ||
- Run `npm audit fix --production` to apply most important fixes | ||
1. Run `npm i` | ||
1. Run `npm test` | ||
1. Merge PR with all changes | ||
1. Create GitHub release | ||
1. Tag and publish the release | ||
- GitHub Action will publish it to npm | ||
## License | ||
@@ -223,0 +202,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2687529
9
9
122073
214
1
- Removedprettier@^2.8.8
- Removedprettier@2.8.8(transitive)