From a14a3a3241be73d55d2dc626ebf9f69b9cd78fee Mon Sep 17 00:00:00 2001 From: JrMasterModelBuilder Date: Fri, 22 Sep 2023 01:09:48 -0400 Subject: [PATCH] Modern codebase --- .babelrc | 16 - .eslintignore | 5 +- .eslintrc.yaml | 22 +- .github/workflows/main.yaml | 26 +- .gitignore | 4 +- .npmignore | 19 +- .nvmrc | 2 +- .prettierignore | 4 +- README.md | 2 +- babel.config.js | 69 ++ gulpfile.babel.ts | 197 ------ module.mjs | 1 - package-lock.json | 772 ++++++++++++++++++++- package.json | 54 +- spec/.eslintrc.yaml | 49 -- spec/.gitignore | 1 - spec/helpers/reporter.js | 15 - spec/helpers/sourcemap.js | 4 - spec/support/jasmine.esm.json | 7 - spec/support/jasmine.json | 7 - src/meta.spec.ts | 11 - src/meta.test.ts | 14 + src/meta.ts | 4 +- src/{plist.spec.ts => plist.test.ts} | 123 ++-- src/util.spec.ts | 69 -- src/util.test.ts | 72 ++ src/{value.spec.ts => value.test.ts} | 27 +- src/value/{array.spec.ts => array.test.ts} | 75 +- src/value/boolean.spec.ts | 72 -- src/value/boolean.test.ts | 75 ++ src/value/{data.spec.ts => data.test.ts} | 114 +-- src/value/date.spec.ts | 65 -- src/value/date.test.ts | 69 ++ src/value/{dict.spec.ts => dict.test.ts} | 87 +-- src/value/integer.spec.ts | 189 ----- src/value/integer.test.ts | 194 ++++++ src/value/real.spec.ts | 113 --- src/value/real.test.ts | 116 ++++ src/value/string.spec.ts | 75 -- src/value/string.test.ts | 80 +++ tsconfig.json | 8 +- 41 files changed, 1769 insertions(+), 1159 deletions(-) delete mode 100644 .babelrc create mode 100644 babel.config.js delete mode 100644 gulpfile.babel.ts delete mode 100644 module.mjs delete mode 100644 spec/.eslintrc.yaml delete mode 100644 spec/.gitignore delete mode 100644 spec/helpers/reporter.js delete mode 100644 spec/helpers/sourcemap.js delete mode 100644 spec/support/jasmine.esm.json delete mode 100644 spec/support/jasmine.json delete mode 100644 src/meta.spec.ts create mode 100644 src/meta.test.ts rename src/{plist.spec.ts => plist.test.ts} (53%) delete mode 100644 src/util.spec.ts create mode 100644 src/util.test.ts rename src/{value.spec.ts => value.test.ts} (67%) rename src/value/{array.spec.ts => array.test.ts} (54%) delete mode 100644 src/value/boolean.spec.ts create mode 100644 src/value/boolean.test.ts rename src/value/{data.spec.ts => data.test.ts} (54%) delete mode 100644 src/value/date.spec.ts create mode 100644 src/value/date.test.ts rename src/value/{dict.spec.ts => dict.test.ts} (62%) delete mode 100644 src/value/integer.spec.ts create mode 100644 src/value/integer.test.ts delete mode 100644 src/value/real.spec.ts create mode 100644 src/value/real.test.ts delete mode 100644 src/value/string.spec.ts create mode 100644 src/value/string.test.ts diff --git a/.babelrc b/.babelrc deleted file mode 100644 index e8dffba..0000000 --- a/.babelrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "modules": "commonjs", - "exclude": ["proposal-dynamic-import"], - "targets": { - "node": "14.15.0" - } - } - ], - ["@babel/preset-typescript"] - ], - "plugins": [] -} diff --git a/.eslintignore b/.eslintignore index 59a0dc9..28253de 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ -/lib -/module.mjs +/dts +/esm +/cjs diff --git a/.eslintrc.yaml b/.eslintrc.yaml index b788308..768211a 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -246,6 +246,10 @@ rules: MethodDefinition: true checkGetters: true checkSetters: true + jsdoc/tag-lines: + - warn + - never + - startLines: 1 # TypeScript Simple: '@typescript-eslint/array-type': error @@ -445,12 +449,20 @@ overrides: rules: '@typescript-eslint/no-unsafe-assignment': off '@typescript-eslint/no-unsafe-member-access': off + '@typescript-eslint/no-unsafe-call': off + '@typescript-eslint/no-unsafe-return': off - files: - '*.ts' - '*.tsx' rules: jsdoc/no-types: warn - files: + - '*.test.js' + - '*.test.jsx' + - '*.test.mjs' + - '*.test.mjsx' + - '*.test.ts' + - '*.test.tsx' - '*.spec.js' - '*.spec.jsx' - '*.spec.mjs' @@ -458,9 +470,13 @@ overrides: - '*.spec.ts' - '*.spec.tsx' rules: + no-void: off jsdoc/require-jsdoc: off + '@typescript-eslint/no-floating-promises': + - error + - ignoreVoid: true - files: - - 'gulpfile.babel.ts' + - 'babel.config.js' rules: import/no-extraneous-dependencies: - error @@ -468,3 +484,7 @@ overrides: optionalDependencies: false peerDependencies: false jsdoc/require-jsdoc: off + '@typescript-eslint/no-require-imports': off + '@typescript-eslint/no-var-requires': off + parserOptions: + sourceType: script diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1bfeb64..6badbe8 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -7,19 +7,17 @@ jobs: strategy: matrix: config: - - node-version: '14.15.0' # LTS - NO_FORMATTED: 1 - NO_LINT: 1 + - runs-on: ubuntu-latest + node-version: '18.12.0' # LTS - - node-version: '16.13.0' # LTS - NO_FORMATTED: 1 - NO_LINT: 1 + - runs-on: ubuntu-latest + node-version: '18.18.0' # LTS (current) + CODE_CHECK: 1 - - node-version: '18.12.0' # LTS (current) + - runs-on: ubuntu-latest + node-version: '20.7.0' - - node-version: '19.0.0' # Latest - - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.config.runs-on }} steps: - name: Checkout @@ -44,17 +42,17 @@ jobs: - name: Lint run: npm run lint - if: matrix.config.NO_LINT != 1 + if: matrix.config.CODE_CHECK == 1 - name: Formatted run: npm run formatted - if: matrix.config.NO_FORMATTED != 1 + if: matrix.config.CODE_CHECK == 1 publish: if: startsWith(github.ref, 'refs/tags/') needs: build - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout @@ -63,7 +61,7 @@ jobs: - name: Node uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '18.18.0' registry-url: https://registry.npmjs.org/ - name: Dependencies diff --git a/.gitignore b/.gitignore index 057e450..cd64c5c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,6 @@ yarn.lock .vscode # Build files -/lib +/dts +/esm +/cjs diff --git a/.npmignore b/.npmignore index b40caea..f13eb5e 100644 --- a/.npmignore +++ b/.npmignore @@ -25,20 +25,25 @@ yarn.lock /.gitattributes /.gitignore /.github -/.babelrc /.editorconfig /.eslintignore /.eslintrc.yaml /.prettierrc.yaml /.prettierignore +/babel.config.js /tsconfig.json /tsconfig.eslint.json -/gulpfile.babel.ts /spec /src -/lib/**/*.spec.d.ts -/lib/**/*.spec.js -/lib/**/*.spec.js.map -/lib/**/*.spec.mjs -/lib/**/*.spec.mjs.map +/dts/**/*.test.d.ts +/esm/**/*.test.mjs +/esm/**/*.test.mjs.map +/cjs/**/*.test.js +/cjs/**/*.test.js.map + +/dts/**/*.spec.d.ts +/esm/**/*.spec.mjs +/esm/**/*.spec.mjs.map +/cjs/**/*.spec.js +/cjs/**/*.spec.js.map diff --git a/.nvmrc b/.nvmrc index 3e558c9..02c8b48 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.12.0 +18.18.0 diff --git a/.prettierignore b/.prettierignore index 5dfc00d..b6fd87e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,4 @@ /package-lock.json -/lib +/dts +/esm +/cjs diff --git a/README.md b/README.md index 2362664..0083e4b 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ If you find a bug or have compatibility issues, please open a ticket under issue # License -Copyright (c) 2019-2022 JrMasterModelBuilder +Copyright (c) 2019-2023 JrMasterModelBuilder Licensed under the Mozilla Public License, v. 2.0. diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..6fa61fe --- /dev/null +++ b/babel.config.js @@ -0,0 +1,69 @@ +'use strict'; + +const {name, version, engines} = require('./package.json'); + +const node = engines.node + .split(/[^\d.]+/) + .filter(s => s.length) + .map(s => [...s.split('.').map(s => +s || 0), 0, 0].slice(0, 3)) + .sort((a, b) => a[2] - b[2]) + .sort((a, b) => a[1] - b[1]) + .sort((a, b) => a[0] - b[0])[0] + .join('.'); + +module.exports = api => { + const env = api.env(); + api.cache(() => env); + const modules = env === 'esm' ? false : 'commonjs'; + const ext = modules ? '.js' : '.mjs'; + const presets = []; + const plugins = []; + presets.push([ + '@babel/preset-env', + { + modules, + exclude: ['proposal-dynamic-import'], + targets: { + node + } + } + ]); + presets.push(['@babel/preset-typescript']); + if (modules === 'commonjs') { + plugins.push([ + '@babel/plugin-transform-modules-commonjs', + { + importInterop: 'node' + } + ]); + } + plugins.push([ + 'esm-resolver', + { + source: { + extensions: [ + [['.js', '.mjs', '.jsx', '.mjsx', '.ts', '.tsx'], ext] + ] + } + } + ]); + plugins.push([ + 'search-and-replace', + { + rules: [ + { + search: '#{NAME}', + replace: name + }, + { + search: '#{VERSION}', + replace: version + } + ] + } + ]); + return { + presets, + plugins + }; +}; diff --git a/gulpfile.babel.ts b/gulpfile.babel.ts deleted file mode 100644 index 488a1ed..0000000 --- a/gulpfile.babel.ts +++ /dev/null @@ -1,197 +0,0 @@ -import {readFile, rm} from 'fs/promises'; -import {basename} from 'path'; -import {pipeline} from 'stream'; -import {spawn} from 'child_process'; -import {promisify} from 'util'; - -import gulp from 'gulp'; -import gulpRename from 'gulp-rename'; -import gulpInsert from 'gulp-insert'; -import gulpFilter from 'gulp-filter'; -import gulpReplace from 'gulp-replace'; -import gulpSourcemaps from 'gulp-sourcemaps'; -import gulpBabel from 'gulp-babel'; - -const pipe = promisify(pipeline); - -async function exec(cmd: string, args: string[] = []) { - const code = await new Promise((resolve, reject) => { - const p = spawn(cmd, args, { - stdio: 'inherit', - shell: true - }); - p.once('close', resolve); - p.once('error', reject); - }); - if (code) { - throw new Error(`Exit code: ${code}`); - } -} - -async function packageJson() { - return JSON.parse(await readFile('package.json', 'utf8')) as { - [p: string]: string; - }; -} - -async function babelrc() { - return { - ...JSON.parse(await readFile('.babelrc', 'utf8')), - babelrc: false - } as { - presets: [string, unknown][]; - babelOpts: unknown[]; - plugins: unknown[]; - }; -} - -async function babelTarget( - src: string[], - dest: string, - modules: string | boolean -) { - const ext = modules ? '.js' : '.mjs'; - - const babelOptions = await babelrc(); - for (const preset of babelOptions.presets) { - if (preset[0] === '@babel/preset-env') { - (preset[1] as {modules: string | boolean}).modules = modules; - } - } - if (modules === 'commonjs') { - babelOptions.plugins.push([ - '@babel/plugin-transform-modules-commonjs', - {importInterop: 'node'} - ]); - } - babelOptions.plugins.push([ - 'esm-resolver', - { - source: { - extensions: [ - [['.js', '.mjs', '.jsx', '.mjsx', '.ts', '.tsx'], ext] - ] - } - } - ]); - - // Read the package JSON. - const pkg = await packageJson(); - - // Filter meta data file and create replace transform. - const filterMeta = gulpFilter(['*/meta.ts'], {restore: true}); - const filterMetaReplaces = [ - ["'@VERSION@'", JSON.stringify(pkg.version)], - ["'@NAME@'", JSON.stringify(pkg.name)] - ].map(([f, r]) => gulpReplace(f, r)); - - await pipe( - gulp.src(src), - filterMeta, - ...filterMetaReplaces, - filterMeta.restore, - gulpSourcemaps.init(), - gulpBabel(babelOptions as {}), - gulpRename(path => { - path.extname = ext; - }), - gulpSourcemaps.write('.', { - includeContent: true, - addComment: false, - destPath: dest - }), - gulpInsert.transform((code, {path}) => { - if (path.endsWith(ext)) { - return `${code}\n//# sourceMappingURL=${basename(path)}.map\n`; - } - return code; - }), - gulp.dest(dest) - ); -} - -// clean - -gulp.task('clean', async () => { - await rm('lib', {recursive: true, force: true}); -}); - -// lint - -gulp.task('lint', async () => { - await exec('eslint', ['.']); -}); - -// formatting - -gulp.task('format', async () => { - await exec('prettier', ['-w', '.']); -}); - -gulp.task('formatted', async () => { - await exec('prettier', ['-c', '.']); -}); - -// build - -gulp.task('build:dts', async () => { - await exec('tsc'); -}); - -gulp.task('build:cjs', async () => { - await babelTarget(['src/**/*.ts'], 'lib', 'commonjs'); -}); - -gulp.task('build:esm', async () => { - await babelTarget(['src/**/*.ts'], 'lib', false); -}); - -gulp.task('build', gulp.parallel(['build:dts', 'build:cjs', 'build:esm'])); - -// test - -gulp.task('test:cjs', async () => { - await exec('jasmine'); -}); - -gulp.task('test:esm', async () => { - await exec('jasmine', ['--config=spec/support/jasmine.esm.json']); -}); - -gulp.task('test', gulp.series(['test:cjs', 'test:esm'])); - -// watch - -gulp.task('watch', () => { - gulp.watch(['src/**/*'], gulp.series(['all'])); -}); - -gulp.task('watch:cjs', () => { - gulp.watch(['src/**/*'], gulp.series(['all:cjs'])); -}); - -gulp.task('watch:esm', () => { - gulp.watch(['src/**/*'], gulp.series(['all:esm'])); -}); - -// all - -gulp.task( - 'all:cjs', - gulp.series(['clean', 'build:cjs', 'test:cjs', 'lint', 'formatted']) -); - -gulp.task( - 'all:esm', - gulp.series(['clean', 'build:esm', 'test:esm', 'lint', 'formatted']) -); - -gulp.task('all', gulp.series(['clean', 'build', 'test', 'lint', 'formatted'])); - -// prepack - -gulp.task('prepack', gulp.series(['clean', 'build'])); - -// default - -gulp.task('default', gulp.series(['all'])); diff --git a/module.mjs b/module.mjs deleted file mode 100644 index de3a74e..0000000 --- a/module.mjs +++ /dev/null @@ -1 +0,0 @@ -export * from './lib/index.mjs'; diff --git a/package-lock.json b/package-lock.json index 08c1202..38d65c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "entities": "^4.4.0" }, "devDependencies": { + "@babel/cli": "^7.22.15", "@babel/core": "^7.19.6", "@babel/preset-env": "^7.19.4", "@babel/preset-typescript": "^7.18.6", @@ -30,6 +31,7 @@ "@typescript-eslint/eslint-plugin": "^5.42.0", "@typescript-eslint/parser": "^5.42.0", "babel-plugin-esm-resolver": "^2.3.0", + "babel-plugin-search-and-replace": "^1.1.1", "eslint": "^8.26.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", @@ -45,11 +47,12 @@ "jasmine-core": "^4.5.0", "jasmine-spec-reporter": "^7.0.0", "prettier": "^2.7.1", + "rimraf": "^5.0.1", "source-map-support": "^0.5.21", "typescript": "^4.8.4" }, "engines": { - "node": ">=14.15.0" + "node": ">=18.12.0" } }, "node_modules/@ampproject/remapping": { @@ -65,6 +68,44 @@ "node": ">=6.0.0" } }, + "node_modules/@babel/cli": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.22.15.tgz", + "integrity": "sha512-prtg5f6zCERIaECeTZzd2fMtVjlfjhUcO+fBLQ6DXXdq5FljN+excVitJ2nogsusdf31LeqkjAfXZ7Xq+HmN8g==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.17", + "commander": "^4.0.1", + "convert-source-map": "^1.1.0", + "fs-readdir-recursive": "^1.1.0", + "glob": "^7.2.0", + "make-dir": "^2.1.0", + "slash": "^2.0.0" + }, + "bin": { + "babel": "bin/babel.js", + "babel-external-helpers": "bin/babel-external-helpers.js" + }, + "engines": { + "node": ">=6.9.0" + }, + "optionalDependencies": { + "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3", + "chokidar": "^3.4.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/cli/node_modules/slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/@babel/code-frame": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", @@ -1864,6 +1905,102 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", @@ -1911,6 +2048,13 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, + "node_modules/@nicolo-ribaudo/chokidar-2": { + "version": "2.1.8-no-fsevents.3", + "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz", + "integrity": "sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==", + "dev": true, + "optional": true + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1946,6 +2090,16 @@ "node": ">= 8" } }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@types/entities": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/entities/-/entities-1.1.1.tgz", @@ -2800,6 +2954,12 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/babel-plugin-search-and-replace": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-search-and-replace/-/babel-plugin-search-and-replace-1.1.1.tgz", + "integrity": "sha512-fjP2VTF3mxxOUnc96mdK22llH92A6gu7A5AFapJmgnqsQi3bqLduIRP0FpA2r5vRZOYPpnX4rE5izQlpsMBjSA==", + "dev": true + }, "node_modules/bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -3311,6 +3471,15 @@ "node": ">=0.1.90" } }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/comment-parser": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.1.tgz", @@ -3625,12 +3794,24 @@ "object.defaults": "^1.1.0" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/electron-to-chromium": { "version": "1.4.284", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz", "integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==", "dev": true }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -4809,6 +4990,21 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/flatted": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", @@ -4846,6 +5042,22 @@ "node": ">=0.10.0" } }, + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -4871,6 +5083,12 @@ "node": ">= 0.10" } }, + "node_modules/fs-readdir-recursive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", + "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", + "dev": true + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -6274,6 +6492,24 @@ "url": "https://bevry.me/fund" } }, + "node_modules/jackspeak": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.3.tgz", + "integrity": "sha512-R2bUw+kVZFS/h1AZqBKrSgDmdmjApzgY0AlCPumopFiAlbUxE2gf+SCuBzQ0cP5hHmUmFYF5yw55T97Th5Kstg==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/jasmine": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-4.5.0.tgz", @@ -6838,6 +7074,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/minipass": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", + "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", @@ -7418,6 +7663,31 @@ "node": ">=0.10.0" } }, + "node_modules/path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dev": true, + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", + "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", + "dev": true, + "engines": { + "node": "14 || >=16.14" + } + }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -8098,15 +8368,64 @@ } }, "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", + "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", "dev": true, "dependencies": { - "glob": "^7.1.3" + "glob": "^10.2.5" }, "bin": { - "rimraf": "bin.js" + "rimraf": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "10.3.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.5.tgz", + "integrity": "sha512-bYUpUD7XDEHI4Q2O5a7PXGvyw4deKR70kHiDxzQbe925wbZknhOzUt2xBgTkYL6RBcVeXYuD9iNYeqoWbBZQnA==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -8274,6 +8593,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -8786,6 +9117,30 @@ "node": ">=0.10.0" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/string-width/node_modules/ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -8847,6 +9202,19 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -9585,6 +9953,80 @@ "node": ">=0.10.0" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/wrap-ansi-cjs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wrap-ansi/node_modules/ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -9697,6 +10139,31 @@ "@jridgewell/trace-mapping": "^0.3.9" } }, + "@babel/cli": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.22.15.tgz", + "integrity": "sha512-prtg5f6zCERIaECeTZzd2fMtVjlfjhUcO+fBLQ6DXXdq5FljN+excVitJ2nogsusdf31LeqkjAfXZ7Xq+HmN8g==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.17", + "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3", + "chokidar": "^3.4.0", + "commander": "^4.0.1", + "convert-source-map": "^1.1.0", + "fs-readdir-recursive": "^1.1.0", + "glob": "^7.2.0", + "make-dir": "^2.1.0", + "slash": "^2.0.0" + }, + "dependencies": { + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true + } + } + }, "@babel/code-frame": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", @@ -10953,6 +11420,71 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "requires": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + }, + "wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + } + } + } + }, "@jridgewell/gen-mapping": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", @@ -10991,6 +11523,13 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, + "@nicolo-ribaudo/chokidar-2": { + "version": "2.1.8-no-fsevents.3", + "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz", + "integrity": "sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==", + "dev": true, + "optional": true + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -11017,6 +11556,13 @@ "fastq": "^1.6.0" } }, + "@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true + }, "@types/entities": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/entities/-/entities-1.1.1.tgz", @@ -11650,6 +12196,12 @@ "@babel/helper-define-polyfill-provider": "^0.3.3" } }, + "babel-plugin-search-and-replace": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-search-and-replace/-/babel-plugin-search-and-replace-1.1.1.tgz", + "integrity": "sha512-fjP2VTF3mxxOUnc96mdK22llH92A6gu7A5AFapJmgnqsQi3bqLduIRP0FpA2r5vRZOYPpnX4rE5izQlpsMBjSA==", + "dev": true + }, "bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -12038,6 +12590,12 @@ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", "dev": true }, + "commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true + }, "comment-parser": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.1.tgz", @@ -12295,12 +12853,24 @@ "object.defaults": "^1.1.0" } }, + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "electron-to-chromium": { "version": "1.4.284", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz", "integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==", "dev": true }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -13242,6 +13812,17 @@ "requires": { "flatted": "^3.1.0", "rimraf": "^3.0.2" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "flatted": { @@ -13275,6 +13856,16 @@ "for-in": "^1.0.1" } }, + "foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + } + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -13294,6 +13885,12 @@ "through2": "^2.0.3" } }, + "fs-readdir-recursive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", + "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", + "dev": true + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -14367,6 +14964,16 @@ "textextensions": "^3.2.0" } }, + "jackspeak": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.3.tgz", + "integrity": "sha512-R2bUw+kVZFS/h1AZqBKrSgDmdmjApzgY0AlCPumopFiAlbUxE2gf+SCuBzQ0cP5hHmUmFYF5yw55T97Th5Kstg==", + "dev": true, + "requires": { + "@isaacs/cliui": "^8.0.2", + "@pkgjs/parseargs": "^0.11.0" + } + }, "jasmine": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-4.5.0.tgz", @@ -14820,6 +15427,12 @@ "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", "dev": true }, + "minipass": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", + "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "dev": true + }, "mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", @@ -15270,6 +15883,24 @@ "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==", "dev": true }, + "path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dev": true, + "requires": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "dependencies": { + "lru-cache": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", + "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", + "dev": true + } + } + }, "path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -15776,12 +16407,45 @@ "dev": true }, "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", + "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", "dev": true, "requires": { - "glob": "^7.1.3" + "glob": "^10.2.5" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "glob": { + "version": "10.3.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.5.tgz", + "integrity": "sha512-bYUpUD7XDEHI4Q2O5a7PXGvyw4deKR70kHiDxzQbe925wbZknhOzUt2xBgTkYL6RBcVeXYuD9iNYeqoWbBZQnA==", + "dev": true, + "requires": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + } + }, + "minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "run-parallel": { @@ -15904,6 +16568,12 @@ "object-inspect": "^1.9.0" } }, + "signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -16354,6 +17024,25 @@ } } }, + "string-width-cjs": { + "version": "npm:string-width@4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + } + } + }, "string.prototype.trimend": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", @@ -16385,6 +17074,15 @@ "ansi-regex": "^5.0.1" } }, + "strip-ansi-cjs": { + "version": "npm:strip-ansi@6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -16980,6 +17678,60 @@ } } }, + "wrap-ansi-cjs": { + "version": "npm:wrap-ansi@7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index cd2f5a0..f005d27 100644 --- a/package.json +++ b/package.json @@ -16,49 +16,47 @@ "decoder", "mac" ], - "main": "lib/index", + "main": "cjs/index", "exports": { - "./module.mjs": "./module.mjs", ".": [ { - "import": "./lib/index.mjs", - "require": "./lib/index.js", - "default": "./lib/index.js" + "import": "./esm/index.mjs", + "require": "./cjs/index.js", + "default": "./cjs/index.js" }, - "./lib/index.js" + "./cjs/index.js" ] }, - "types": "lib/index.d.ts", - "module": "module.mjs", + "types": "dts/index.d.ts", + "module": "esm/index.mjs", "sideEffects": false, "engines": { - "node": ">=14.15.0" + "node": ">=18.12.0" }, "scripts": { - "clean": "gulp clean", - "lint": "gulp lint", - "format": "gulp format", - "formatted": "gulp formatted", - "build:cjs": "gulp build:cjs", - "build:esm": "gulp build:esm", - "build": "gulp build", - "test:cjs": "gulp test:cjs", - "test:esm": "gulp test:esm", - "test": "gulp test", - "all:cjs": "gulp all:cjs", - "all:esm": "gulp all:esm", - "all": "gulp all", - "watch:cjs": "gulp watch:cjs", - "watch:esm": "gulp watch:esm", - "watch": "gulp watch", - "prepack": "gulp prepack" + "clean": "rimraf *.log* dts esm cjs", + "lint": "eslint .", + "format": "prettier -w .", + "formatted": "prettier -c .", + "build:dts": "tsc", + "build:esm": "babel --env-name esm -x .ts -s true -d esm --out-file-extension .mjs src", + "build:cjs": "babel --env-name cjs -x .ts -s true -d cjs --out-file-extension .js src", + "build": "npm run build:dts && npm run build:esm && npm run build:cjs", + "test:esm": "node -r source-map-support/register --test esm", + "test:cjs": "node -r source-map-support/register --test cjs", + "test": "npm run test:esm && npm run test:cjs", + "all:esm": "npm run clean && npm run build:esm && npm run test:esm && npm run lint && npm run formatted", + "all:cjs": "npm run clean && npm run build:cjs && npm run test:cjs && npm run lint && npm run formatted", + "all": "npm run clean && npm run build && npm run test && npm run lint && npm run formatted", + "prepack": "npm run clean && npm run build" }, "repository": "https://github.com/shockpkg/plist-dom.git", "bugs": "https://github.com/shockpkg/plist-dom/issues", "author": "JrMasterModelBuilder", - "copyright": "Copyright (c) 2019-2022 JrMasterModelBuilder", + "copyright": "Copyright (c) 2019-2023 JrMasterModelBuilder", "license": "MPL-2.0", "devDependencies": { + "@babel/cli": "^7.22.15", "@babel/core": "^7.19.6", "@babel/preset-env": "^7.19.4", "@babel/preset-typescript": "^7.18.6", @@ -76,6 +74,7 @@ "@typescript-eslint/eslint-plugin": "^5.42.0", "@typescript-eslint/parser": "^5.42.0", "babel-plugin-esm-resolver": "^2.3.0", + "babel-plugin-search-and-replace": "^1.1.1", "eslint": "^8.26.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", @@ -91,6 +90,7 @@ "jasmine-core": "^4.5.0", "jasmine-spec-reporter": "^7.0.0", "prettier": "^2.7.1", + "rimraf": "^5.0.1", "source-map-support": "^0.5.21", "typescript": "^4.8.4" }, diff --git a/spec/.eslintrc.yaml b/spec/.eslintrc.yaml deleted file mode 100644 index c0ead29..0000000 --- a/spec/.eslintrc.yaml +++ /dev/null @@ -1,49 +0,0 @@ -rules: - # ECMAScript 6: - arrow-body-style: off - arrow-parens: off - arrow-spacing: off - constructor-super: off - generator-star-spacing: off - no-class-assign: off - no-confusing-arrow: off - no-const-assign: off - no-dupe-class-members: off - no-duplicate-imports: off - no-new-symbol: off - no-this-before-super: off - no-useless-computed-key: off - no-useless-rename: off - no-var: off - object-shorthand: off - prefer-arrow-callback: off - prefer-const: off - prefer-destructuring: off - prefer-numeric-literals: off - prefer-rest-params: off - prefer-spread: off - prefer-template: off - require-yield: off - rest-spread-spacing: off - symbol-description: off - template-curly-spacing: off - yield-star-spacing: off - - # Import plugin: - import/no-extraneous-dependencies: - - error - - devDependencies: true - - # JSDoc plugin: - jsdoc/require-jsdoc: off - - # TypeScript plugin: - '@typescript-eslint/no-require-imports': off - '@typescript-eslint/no-var-requires': off - -parserOptions: - ecmaVersion: 5 - sourceType: script - -env: - es6: false diff --git a/spec/.gitignore b/spec/.gitignore deleted file mode 100644 index 813ef11..0000000 --- a/spec/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/projectors diff --git a/spec/helpers/reporter.js b/spec/helpers/reporter.js deleted file mode 100644 index 7acd99f..0000000 --- a/spec/helpers/reporter.js +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-env jasmine */ - -'use strict'; - -var SpecReporter = require('jasmine-spec-reporter').SpecReporter; - -jasmine.getEnv().clearReporters(); -jasmine.getEnv().addReporter( - new SpecReporter({ - spec: { - displayPending: true, - displayStacktrace: 'raw' - } - }) -); diff --git a/spec/helpers/sourcemap.js b/spec/helpers/sourcemap.js deleted file mode 100644 index 350c77a..0000000 --- a/spec/helpers/sourcemap.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; - -// Get source map support in exceptions, works on Node level. -require('source-map-support').install(); diff --git a/spec/support/jasmine.esm.json b/spec/support/jasmine.esm.json deleted file mode 100644 index df4a3f3..0000000 --- a/spec/support/jasmine.esm.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "spec_dir": "", - "spec_files": ["lib/**/*.spec.mjs"], - "helpers": ["spec/helpers/**/*.js"], - "stopSpecOnExpectationFailure": false, - "random": false -} diff --git a/spec/support/jasmine.json b/spec/support/jasmine.json deleted file mode 100644 index d8d7a26..0000000 --- a/spec/support/jasmine.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "spec_dir": "", - "spec_files": ["lib/**/*.spec.js"], - "helpers": ["spec/helpers/**/*.js"], - "stopSpecOnExpectationFailure": false, - "random": false -} diff --git a/src/meta.spec.ts b/src/meta.spec.ts deleted file mode 100644 index 38c6a38..0000000 --- a/src/meta.spec.ts +++ /dev/null @@ -1,11 +0,0 @@ -import {NAME, VERSION} from './meta'; - -describe('meta', () => { - it('NAME', () => { - expect(typeof NAME).toBe('string'); - }); - - it('VERSION', () => { - expect(typeof VERSION).toBe('string'); - }); -}); diff --git a/src/meta.test.ts b/src/meta.test.ts new file mode 100644 index 0000000..d66e23e --- /dev/null +++ b/src/meta.test.ts @@ -0,0 +1,14 @@ +import {describe, it} from 'node:test'; +import {match} from 'node:assert'; + +import {NAME, VERSION} from './meta'; + +void describe('meta', () => { + void it('NAME', () => { + match(NAME, /^(@[a-z0-9._-]+\/)?[a-z0-9._-]+/); + }); + + void it('VERSION', () => { + match(VERSION, /^\d+\.\d+\.\d+/); + }); +}); diff --git a/src/meta.ts b/src/meta.ts index 6f6b185..a0147b1 100644 --- a/src/meta.ts +++ b/src/meta.ts @@ -1,5 +1,5 @@ // This file contains compile-time defined variables. -export const NAME: string = '@NAME@'; +export const NAME: string = '#{NAME}'; -export const VERSION: string = '@VERSION@'; +export const VERSION: string = '#{VERSION}'; diff --git a/src/plist.spec.ts b/src/plist.test.ts similarity index 53% rename from src/plist.spec.ts rename to src/plist.test.ts index 703ed68..cc05a8d 100644 --- a/src/plist.spec.ts +++ b/src/plist.test.ts @@ -1,4 +1,7 @@ /* eslint-disable max-nested-callbacks */ +import {describe, it} from 'node:test'; +import {ok, strictEqual, throws} from 'node:assert'; + import {Plist} from './plist'; import {ValueBoolean} from './value/boolean'; import {ValueString} from './value/string'; @@ -13,158 +16,162 @@ function plistBodyExtract(s: string) { return s.replace(/^[\s\S]*]*>([\s\S]*)<\/plist>\n*$/, '$1'); } -describe('document', () => { - describe('Plist', () => { - describe('constructor', () => { - it('null', () => { +void describe('document', () => { + void describe('Plist', () => { + void void describe('constructor', () => { + void void it('null', () => { const doc = new Plist(); - expect(doc.value).toBeNull(); + strictEqual(doc.value, null); }); - it('value', () => { + void it('value', () => { const value = new ValueBoolean(true); const doc = new Plist(value); - expect(doc.value).toBe(value); + strictEqual(doc.value, value); }); }); - describe('getValue', () => { - it('null', () => { + void describe('getValue', () => { + void it('null', () => { const doc = new Plist(); - expect(() => doc.getValue()).toThrow(); + throws(() => doc.getValue()); }); - it('boolean', () => { + void it('boolean', () => { const doc = new Plist(new ValueBoolean()); - expect(doc.getValue()).toBeTruthy(); + ok(doc.getValue()); }); }); - describe('valueCastTo', () => { - it('null', () => { + void describe('valueCastTo', () => { + void it('null', () => { const doc = new Plist(); - expect(doc.valueCastTo(ValueString)).toBeNull(); + strictEqual(doc.valueCastTo(ValueString), null); }); - it('same type', () => { + void it('same type', () => { const doc = new Plist(new ValueBoolean()); - expect(doc.valueCastTo(ValueBoolean)).toBeTruthy(); + ok(doc.valueCastTo(ValueBoolean)); }); - it('different type', () => { + void it('different type', () => { const doc = new Plist(new ValueBoolean()); - expect(doc.valueCastTo(ValueString)).toBeNull(); + strictEqual(doc.valueCastTo(ValueString), null); }); }); - describe('valueCastAs', () => { - it('null', () => { + void describe('valueCastAs', () => { + void it('null', () => { const doc = new Plist(); - expect(() => doc.valueCastAs(ValueString)).toThrow(); + throws(() => doc.valueCastAs(ValueString)); }); - it('same type', () => { + void it('same type', () => { const doc = new Plist(new ValueBoolean()); - expect(doc.valueCastAs(ValueBoolean)).toBeTruthy(); + ok(doc.valueCastAs(ValueBoolean)); }); - it('different type', () => { + void it('different type', () => { const doc = new Plist(new ValueBoolean()); - expect(() => doc.valueCastAs(ValueString)).toThrow(); + throws(() => doc.valueCastAs(ValueString)); }); }); - describe('toXml', () => { - it('null', () => { + void describe('toXml', () => { + void it('null', () => { const doc = new Plist(); - expect( + strictEqual( plistBodyExtract( doc.toXml({ indentRoot: false }) - ) - ).toBe('\n'); - expect( + ), + '\n' + ); + strictEqual( plistBodyExtract( doc.toXml({ indentRoot: true }) - ) - ).toBe('\n'); + ), + '\n' + ); }); - it('true', () => { + void it('true', () => { const doc = new Plist(new ValueBoolean(true)); - expect( + strictEqual( plistBodyExtract( doc.toXml({ indentRoot: false }) - ) - ).toBe('\n\n'); - expect( + ), + '\n\n' + ); + strictEqual( plistBodyExtract( doc.toXml({ indentRoot: true }) - ) - ).toBe('\n\t\n'); + ), + '\n\t\n' + ); }); - it('xmlDeclaration', () => { + void it('xmlDeclaration', () => { const doc = new Plist(new ValueBoolean(true)); const linesA = doc.toXml().split('\n'); - expect(linesA[0]).toBe(doc.xmlDeclaration); + strictEqual(linesA[0], doc.xmlDeclaration); doc.xmlDeclaration = ''; const linesB = doc.toXml().split('\n'); - expect(linesB[0]).toBe(doc.xmlDeclaration); + strictEqual(linesB[0], doc.xmlDeclaration); }); - it('doctype', () => { + void it('doctype', () => { const doc = new Plist(new ValueBoolean(true)); const linesA = doc.toXml().split('\n'); - expect(linesA[1]).toBe(doc.xmlDoctype); + strictEqual(linesA[1], doc.xmlDoctype); doc.xmlDoctype = ''; const linesB = doc.toXml().split('\n'); - expect(linesB[1]).toBe(doc.xmlDoctype); + strictEqual(linesB[1], doc.xmlDoctype); }); - it('plist tags', () => { + void it('plist tags', () => { const doc = new Plist(new ValueBoolean(true)); const linesA = doc.toXml().split('\n'); - expect(linesA[2]).toBe(''); - expect(linesA[linesA.length - 2]).toBe(''); + strictEqual(linesA[2], ''); + strictEqual(linesA[linesA.length - 2], ''); }); - it('trailing newline', () => { + void it('trailing newline', () => { const doc = new Plist(new ValueBoolean(true)); const xml = doc.toXml(); - expect(xml.endsWith('\n')).toBe(true); + strictEqual(xml.endsWith('\n'), true); }); }); - describe('fromXml', () => { - it('null', () => { + void describe('fromXml', () => { + void it('null', () => { const doc = new Plist(); const xml = doc.toXml(); doc.value = new ValueBoolean(true); doc.fromXml(xml); - expect(doc.value).toBeNull(); + strictEqual(doc.value, null); }); - it('boolean', () => { + void it('boolean', () => { const doc = new Plist(); doc.value = new ValueBoolean(false); const xml = doc.toXml(); doc.value = new ValueBoolean(true); doc.fromXml(xml); const {value} = doc; - expect(value).toBeTruthy(); + ok(value); if (value) { - expect(value.toXml()).toBe(new ValueBoolean(false).toXml()); + strictEqual(value.toXml(), new ValueBoolean(false).toXml()); } }); }); diff --git a/src/util.spec.ts b/src/util.spec.ts deleted file mode 100644 index 19634cf..0000000 --- a/src/util.spec.ts +++ /dev/null @@ -1,69 +0,0 @@ -import {stringChunk, xmlDecode, decodeIntBase10} from './util'; - -describe('util', () => { - describe('stringChunk', () => { - it('exact', () => { - expect(stringChunk('12345678', 4)).toEqual(['1234', '5678']); - }); - - it('extra', () => { - expect(stringChunk('123456789', 4)).toEqual(['1234', '5678', '9']); - }); - - it('less', () => { - expect(stringChunk('123', 4)).toEqual(['123']); - }); - }); - - describe('xmlDecode', () => { - const declaration = ''; - const doctype = - ''; - - it('declaration', () => { - const o = xmlDecode(`\n${declaration}\na\n`); - expect(o.declaration).toBe(declaration); - expect(o.doctype).toBeNull(); - expect(o.documentElement.toString()).toBe('a'); - }); - - it('doctype', () => { - const o = xmlDecode(`\n${doctype}\na\n`); - expect(o.declaration).toBeNull(); - expect(o.doctype).toBe(doctype); - expect(o.documentElement.toString()).toBe('a'); - }); - - it('declaration + doctype', () => { - const o = xmlDecode(`\n${declaration}\n${doctype}\na\n`); - expect(o.declaration).toBe(declaration); - expect(o.doctype).toBe(doctype); - expect(o.documentElement.toString()).toBe('a'); - }); - - it('documentElement', () => { - const o = xmlDecode('\na\n'); - expect(o.declaration).toBeNull(); - expect(o.doctype).toBeNull(); - expect(o.documentElement.toString()).toBe('a'); - }); - }); - - describe('decodeIntBase10', () => { - it('0', () => { - expect(decodeIntBase10('0')).toBe(0); - }); - - it('+42', () => { - expect(decodeIntBase10('+42')).toBe(42); - }); - - it('42', () => { - expect(decodeIntBase10('42')).toBe(42); - }); - - it('-42', () => { - expect(decodeIntBase10('-42')).toBe(-42); - }); - }); -}); diff --git a/src/util.test.ts b/src/util.test.ts new file mode 100644 index 0000000..200ab71 --- /dev/null +++ b/src/util.test.ts @@ -0,0 +1,72 @@ +import {describe, it} from 'node:test'; +import {deepStrictEqual, strictEqual} from 'node:assert'; + +import {stringChunk, xmlDecode, decodeIntBase10} from './util'; + +void describe('util', () => { + void describe('stringChunk', () => { + void it('exact', () => { + deepStrictEqual(stringChunk('12345678', 4), ['1234', '5678']); + }); + + void it('extra', () => { + deepStrictEqual(stringChunk('123456789', 4), ['1234', '5678', '9']); + }); + + void it('less', () => { + deepStrictEqual(stringChunk('123', 4), ['123']); + }); + }); + + void describe('xmlDecode', () => { + const declaration = ''; + const doctype = + ''; + + void it('declaration', () => { + const o = xmlDecode(`\n${declaration}\na\n`); + strictEqual(o.declaration, declaration); + strictEqual(o.doctype, null); + strictEqual(o.documentElement.toString(), 'a'); + }); + + void it('doctype', () => { + const o = xmlDecode(`\n${doctype}\na\n`); + strictEqual(o.declaration, null); + strictEqual(o.doctype, doctype); + strictEqual(o.documentElement.toString(), 'a'); + }); + + void it('declaration + doctype', () => { + const o = xmlDecode(`\n${declaration}\n${doctype}\na\n`); + strictEqual(o.declaration, declaration); + strictEqual(o.doctype, doctype); + strictEqual(o.documentElement.toString(), 'a'); + }); + + void it('documentElement', () => { + const o = xmlDecode('\na\n'); + strictEqual(o.declaration, null); + strictEqual(o.doctype, null); + strictEqual(o.documentElement.toString(), 'a'); + }); + }); + + void describe('decodeIntBase10', () => { + void it('0', () => { + strictEqual(decodeIntBase10('0'), 0); + }); + + void it('+42', () => { + strictEqual(decodeIntBase10('+42'), 42); + }); + + void it('42', () => { + strictEqual(decodeIntBase10('42'), 42); + }); + + void it('-42', () => { + strictEqual(decodeIntBase10('-42'), -42); + }); + }); +}); diff --git a/src/value.spec.ts b/src/value.test.ts similarity index 67% rename from src/value.spec.ts rename to src/value.test.ts index 72c7bb6..4f721b3 100644 --- a/src/value.spec.ts +++ b/src/value.test.ts @@ -1,5 +1,8 @@ /* eslint-disable max-nested-callbacks */ /* eslint-disable max-classes-per-file */ +import {describe, it} from 'node:test'; +import {ok, strictEqual, throws} from 'node:assert'; + import {IToXmlOptioned} from './options'; import {IElement} from './util'; import {Value} from './value'; @@ -42,29 +45,29 @@ class ValueB extends Value { } } -describe('value', () => { - describe('Value', () => { - describe('castTo', () => { - it('same type', () => { +void describe('value', () => { + void describe('Value', () => { + void describe('castTo', () => { + void it('same type', () => { const value = new ValueA(); - expect(value.castTo(ValueA)).toBeTruthy(); + ok(value.castTo(ValueA)); }); - it('different type', () => { + void it('different type', () => { const value = new ValueA(); - expect(value.castTo(ValueB)).toBeNull(); + strictEqual(value.castTo(ValueB), null); }); }); - describe('castAs', () => { - it('same type', () => { + void describe('castAs', () => { + void it('same type', () => { const value = new ValueA(); - expect(value.castAs(ValueA)).toBeTruthy(); + ok(value.castAs(ValueA)); }); - it('different type', () => { + void it('different type', () => { const value = new ValueA(); - expect(() => value.castAs(ValueB)).toThrow(); + throws(() => value.castAs(ValueB)); }); }); }); diff --git a/src/value/array.spec.ts b/src/value/array.test.ts similarity index 54% rename from src/value/array.spec.ts rename to src/value/array.test.ts index c5a614a..af272cc 100644 --- a/src/value/array.spec.ts +++ b/src/value/array.test.ts @@ -1,55 +1,62 @@ /* eslint-disable max-nested-callbacks */ +import {describe, it} from 'node:test'; +import {strictEqual, throws} from 'node:assert'; + import {Value} from '../value'; import {ValueArray} from './array'; -describe('value/array', () => { - describe('ValueArray', () => { - describe('constructor', () => { - it('length: 0', () => { +void describe('value/array', () => { + void describe('ValueArray', () => { + void describe('constructor', () => { + void it('length: 0', () => { const a: Value[] = []; const el = new ValueArray(a); - expect(el.value).toBe(a); + strictEqual(el.value, a); }); - it('length: 1', () => { + void it('length: 1', () => { const a: Value[] = [new ValueArray()]; const el = new ValueArray(a); - expect(el.value).toBe(a); + strictEqual(el.value, a); }); - it('length: 2', () => { + void it('length: 2', () => { const a: Value[] = [new ValueArray(), new ValueArray()]; const el = new ValueArray(a); - expect(el.value).toBe(a); + strictEqual(el.value, a); }); }); - describe('toXml', () => { - it('length: 0', () => { + void describe('toXml', () => { + void it('length: 0', () => { const el = new ValueArray([]); - expect(el.toXml()).toBe(''); - expect(el.toXml(null, 1)).toBe('\t'); + strictEqual(el.toXml(), ''); + strictEqual(el.toXml(null, 1), '\t'); }); - it('length: 1', () => { + void it('length: 1', () => { const el = new ValueArray([new ValueArray()]); - expect(el.toXml()).toBe( + strictEqual( + el.toXml(), ['', '\t', ''].join('\n') ); - expect(el.toXml(null, 1)).toBe( + strictEqual( + el.toXml(null, 1), ['\t', '\t\t', '\t'].join('\n') ); }); - it('length: 2', () => { + void it('length: 2', () => { const el = new ValueArray([new ValueArray(), new ValueArray()]); - expect(el.toXml()).toBe( + strictEqual( + el.toXml(), ['', '\t', '\t', ''].join( '\n' ) ); - expect(el.toXml(null, 1)).toBe( + strictEqual( + el.toXml(null, 1), [ '\t', '\t\t', @@ -60,40 +67,40 @@ describe('value/array', () => { }); }); - describe('fromXml', () => { - it('length: 0', () => { + void describe('fromXml', () => { + void it('length: 0', () => { const el = new ValueArray([new ValueArray()]); el.fromXml(''); - expect(el.value.length).toBe(0); + strictEqual(el.value.length, 0); }); - it('length: 1', () => { + void it('length: 1', () => { const el = new ValueArray(); el.fromXml(''); - expect(el.value.length).toBe(1); + strictEqual(el.value.length, 1); }); - it('length: 2', () => { + void it('length: 2', () => { const el = new ValueArray(); el.fromXml(''); - expect(el.value.length).toBe(2); + strictEqual(el.value.length, 2); }); - it('text', () => { + void it('text', () => { const el = new ValueArray(); - expect(() => { + throws(() => { el.fromXml('text'); - }).toThrow(); + }); }); - it('badtag', () => { + void it('badtag', () => { const el = new ValueArray(); - expect(() => { + throws(() => { el.fromXml(''); - }).toThrow(); - expect(() => { + }); + throws(() => { el.fromXml(''); - }).toThrow(); + }); }); }); }); diff --git a/src/value/boolean.spec.ts b/src/value/boolean.spec.ts deleted file mode 100644 index 34f3468..0000000 --- a/src/value/boolean.spec.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* eslint-disable max-nested-callbacks */ -import {ValueBoolean} from './boolean'; - -describe('value/boolean', () => { - describe('ValueBoolean', () => { - describe('constructor', () => { - it('false', () => { - const el = new ValueBoolean(false); - expect(el.value).toBe(false); - }); - - it('true', () => { - const el = new ValueBoolean(true); - expect(el.value).toBe(true); - }); - }); - - describe('toXml', () => { - it('true', () => { - const el = new ValueBoolean(true); - expect(el.toXml()).toBe(''); - expect(el.toXml(null, 1)).toBe('\t'); - }); - - it('false', () => { - const el = new ValueBoolean(false); - expect(el.toXml()).toBe(''); - expect(el.toXml(null, 1)).toBe('\t'); - }); - }); - - describe('fromXml', () => { - it('true', () => { - const el = new ValueBoolean(false); - el.fromXml(''); - expect(el.value).toBe(true); - el.value = false; - el.fromXml(''); - expect(el.value).toBe(true); - }); - - it('false', () => { - const el = new ValueBoolean(true); - el.fromXml(''); - expect(el.value).toBe(false); - el.value = true; - el.fromXml(''); - expect(el.value).toBe(false); - }); - - it('children', () => { - const el = new ValueBoolean(false); - expect(() => { - el.fromXml('a'); - }).toThrow(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - - it('badtag', () => { - const el = new ValueBoolean(false); - expect(() => { - el.fromXml(''); - }).toThrow(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - }); - }); -}); diff --git a/src/value/boolean.test.ts b/src/value/boolean.test.ts new file mode 100644 index 0000000..0b17ada --- /dev/null +++ b/src/value/boolean.test.ts @@ -0,0 +1,75 @@ +/* eslint-disable max-nested-callbacks */ +import {describe, it} from 'node:test'; +import {strictEqual, throws} from 'node:assert'; + +import {ValueBoolean} from './boolean'; + +void describe('value/boolean', () => { + void describe('ValueBoolean', () => { + void describe('constructor', () => { + void it('false', () => { + const el = new ValueBoolean(false); + strictEqual(el.value, false); + }); + + void it('true', () => { + const el = new ValueBoolean(true); + strictEqual(el.value, true); + }); + }); + + void describe('toXml', () => { + void it('true', () => { + const el = new ValueBoolean(true); + strictEqual(el.toXml(), ''); + strictEqual(el.toXml(null, 1), '\t'); + }); + + void it('false', () => { + const el = new ValueBoolean(false); + strictEqual(el.toXml(), ''); + strictEqual(el.toXml(null, 1), '\t'); + }); + }); + + void describe('fromXml', () => { + void it('true', () => { + const el = new ValueBoolean(false); + el.fromXml(''); + strictEqual(el.value, true); + el.value = false; + el.fromXml(''); + strictEqual(el.value, true); + }); + + void it('false', () => { + const el = new ValueBoolean(true); + el.fromXml(''); + strictEqual(el.value, false); + el.value = true; + el.fromXml(''); + strictEqual(el.value, false); + }); + + void it('children', () => { + const el = new ValueBoolean(false); + throws(() => { + el.fromXml('a'); + }); + throws(() => { + el.fromXml(''); + }); + }); + + void it('badtag', () => { + const el = new ValueBoolean(false); + throws(() => { + el.fromXml(''); + }); + throws(() => { + el.fromXml(''); + }); + }); + }); + }); +}); diff --git a/src/value/data.spec.ts b/src/value/data.test.ts similarity index 54% rename from src/value/data.spec.ts rename to src/value/data.test.ts index dcc7e98..d1952b5 100644 --- a/src/value/data.spec.ts +++ b/src/value/data.test.ts @@ -1,132 +1,140 @@ /* eslint-disable max-nested-callbacks */ +import {describe, it} from 'node:test'; +import {strictEqual, throws} from 'node:assert'; + import {ValueData} from './data'; -describe('value/data', () => { - describe('ValueData', () => { - describe('constructor', () => { - it('length: 0', () => { +void describe('value/data', () => { + void describe('ValueData', () => { + void describe('constructor', () => { + void it('length: 0', () => { const el = new ValueData(); - expect(el.value.toString('base64')).toBe(''); + strictEqual(el.value.toString('base64'), ''); }); - it('length: 10', () => { + void it('length: 10', () => { const b = Buffer.alloc(10); const el = new ValueData(b); - expect(el.value).toBe(b); + strictEqual(el.value, b); }); }); - describe('toXml', () => { - it('length: 0', () => { + void describe('toXml', () => { + void it('length: 0', () => { const el = new ValueData(); - expect( + strictEqual( el.toXml({ dataColumns: 6 - }) - ).toBe('\n'); - expect( + }), + '\n' + ); + strictEqual( el.toXml( { dataColumns: 6 }, 1 - ) - ).toBe('\t\n\t'); + ), + '\t\n\t' + ); }); - it('length: 10', () => { + void it('length: 10', () => { const b = Buffer.alloc(10); const el = new ValueData(b); - expect(el.toXml()).toBe('\nAAAAAAAAAAAAAA==\n'); - expect(el.toXml(null, 1)).toBe( + strictEqual(el.toXml(), '\nAAAAAAAAAAAAAA==\n'); + strictEqual( + el.toXml(null, 1), '\t\n\tAAAAAAAAAAAAAA==\n\t' ); }); - it('length: 10 wrapped', () => { + void it('length: 10 wrapped', () => { const b = Buffer.alloc(10); const el = new ValueData(b); - expect( + strictEqual( el.toXml({ dataColumns: 6 - }) - ).toBe('\nAAAAAA\nAAAAAA\nAA==\n'); - expect( + }), + '\nAAAAAA\nAAAAAA\nAA==\n' + ); + strictEqual( el.toXml( { dataColumns: 6 }, 1 - ) - ).toBe('\t\n\tAAAAAA\n\tAAAAAA\n\tAA==\n\t'); + ), + '\t\n\tAAAAAA\n\tAAAAAA\n\tAA==\n\t' + ); }); }); - describe('fromXml', () => { - it('length: 0', () => { + void describe('fromXml', () => { + void it('length: 0', () => { const b = Buffer.alloc(0); const el = new ValueData(b); const xml = el.toXml(); el.value = Buffer.alloc(1); el.fromXml(xml); - expect(el.value.toString('base64')).toBe(b.toString('base64')); + strictEqual(el.value.toString('base64'), b.toString('base64')); }); - it('length: 1', () => { + void it('length: 1', () => { const b = Buffer.alloc(1); const el = new ValueData(b); const xml = el.toXml(); el.value = Buffer.alloc(0); el.fromXml(xml); - expect(el.value.toString('base64')).toBe(b.toString('base64')); + strictEqual(el.value.toString('base64'), b.toString('base64')); }); - it('length: 2', () => { + void it('length: 2', () => { const b = Buffer.alloc(2); const el = new ValueData(b); const xml = el.toXml(); el.value = Buffer.alloc(0); el.fromXml(xml); - expect(el.value.toString('base64')).toBe(b.toString('base64')); + strictEqual(el.value.toString('base64'), b.toString('base64')); }); - it('length: 3', () => { + void it('length: 3', () => { const b = Buffer.alloc(3); const el = new ValueData(b); const xml = el.toXml(); el.value = Buffer.alloc(0); el.fromXml(xml); - expect(el.value.toString('base64')).toBe(b.toString('base64')); + strictEqual(el.value.toString('base64'), b.toString('base64')); }); - it('length: 10', () => { + void it('length: 10', () => { const b = Buffer.alloc(10); const el = new ValueData(b); const xml = el.toXml(); el.value = Buffer.alloc(0); el.fromXml(xml); - expect(el.value.toString('base64')).toBe(b.toString('base64')); + strictEqual(el.value.toString('base64'), b.toString('base64')); }); - it('length: 100', () => { + void it('length: 100', () => { const b = Buffer.alloc(100); const el = new ValueData(b); const xml = el.toXml(); el.value = Buffer.alloc(0); el.fromXml(xml); - expect(el.value.toString('base64')).toBe(b.toString('base64')); + strictEqual(el.value.toString('base64'), b.toString('base64')); }); - it('length: 100', () => { + void it('length: 100', () => { const b = Buffer.alloc(100); const el = new ValueData(b); const xml = el.toXml(); el.value = Buffer.alloc(0); el.fromXml(xml); - expect(el.value.toString('base64')).toBe(b.toString('base64')); + strictEqual(el.value.toString('base64'), b.toString('base64')); }); - it('charset', () => { + void it('charset', () => { const el = new ValueData(); el.fromXml( [ @@ -137,31 +145,31 @@ describe('value/data', () => { '' ].join('\n') ); - expect(el.value.length).toBe(48); + strictEqual(el.value.length, 48); }); - it('baddata', () => { + void it('baddata', () => { const el = new ValueData(); - expect(() => { + throws(() => { el.fromXml('-'); - }).toThrow(); + }); }); - it('children', () => { + void it('children', () => { const el = new ValueData(); - expect(() => { + throws(() => { el.fromXml(''); - }).toThrow(); + }); }); - it('badtag', () => { + void it('badtag', () => { const el = new ValueData(); - expect(() => { + throws(() => { el.fromXml(''); - }).toThrow(); - expect(() => { + }); + throws(() => { el.fromXml(''); - }).toThrow(); + }); }); }); }); diff --git a/src/value/date.spec.ts b/src/value/date.spec.ts deleted file mode 100644 index db786e1..0000000 --- a/src/value/date.spec.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* eslint-disable max-nested-callbacks */ -import {ValueDate} from './date'; - -describe('value/integer', () => { - describe('ValueDate', () => { - describe('constructor', () => { - it('date', () => { - const el = new ValueDate(new Date('2019-01-20T10:12:42.000Z')); - expect(el.value).toEqual(new Date('2019-01-20T10:12:42.000Z')); - }); - }); - - describe('toXml', () => { - it('date', () => { - const el = new ValueDate(new Date('2019-01-20T10:12:42.000Z')); - expect(el.toXml()).toBe('2019-01-20T10:12:42Z'); - expect(el.toXml(null, 1)).toBe( - '\t2019-01-20T10:12:42Z' - ); - }); - }); - - describe('fromXml', () => { - it('date', () => { - const el = new ValueDate(); - el.fromXml('2019-01-20T10:12:42Z'); - expect(el.toXml()).toBe('2019-01-20T10:12:42Z'); - }); - - it('empty', () => { - const el = new ValueDate(); - expect(() => { - el.fromXml(''); - }).toThrow(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - - it('datadata', () => { - const el = new ValueDate(); - expect(() => { - el.fromXml('baddata'); - }).toThrow(); - }); - - it('children', () => { - const el = new ValueDate(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - - it('badtag', () => { - const el = new ValueDate(); - expect(() => { - el.fromXml(''); - }).toThrow(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - }); - }); -}); diff --git a/src/value/date.test.ts b/src/value/date.test.ts new file mode 100644 index 0000000..94c17f9 --- /dev/null +++ b/src/value/date.test.ts @@ -0,0 +1,69 @@ +/* eslint-disable max-nested-callbacks */ +import {describe, it} from 'node:test'; +import {deepStrictEqual, strictEqual, throws} from 'node:assert'; + +import {ValueDate} from './date'; + +void describe('value/integer', () => { + void describe('ValueDate', () => { + void describe('constructor', () => { + void it('date', () => { + const el = new ValueDate(new Date('2019-01-20T10:12:42.000Z')); + deepStrictEqual(el.value, new Date('2019-01-20T10:12:42.000Z')); + }); + }); + + void describe('toXml', () => { + void it('date', () => { + const el = new ValueDate(new Date('2019-01-20T10:12:42.000Z')); + strictEqual(el.toXml(), '2019-01-20T10:12:42Z'); + strictEqual( + el.toXml(null, 1), + '\t2019-01-20T10:12:42Z' + ); + }); + }); + + void describe('fromXml', () => { + void it('date', () => { + const el = new ValueDate(); + el.fromXml('2019-01-20T10:12:42Z'); + strictEqual(el.toXml(), '2019-01-20T10:12:42Z'); + }); + + void it('empty', () => { + const el = new ValueDate(); + throws(() => { + el.fromXml(''); + }); + throws(() => { + el.fromXml(''); + }); + }); + + void it('datadata', () => { + const el = new ValueDate(); + throws(() => { + el.fromXml('baddata'); + }); + }); + + void it('children', () => { + const el = new ValueDate(); + throws(() => { + el.fromXml(''); + }); + }); + + void it('badtag', () => { + const el = new ValueDate(); + throws(() => { + el.fromXml(''); + }); + throws(() => { + el.fromXml(''); + }); + }); + }); + }); +}); diff --git a/src/value/dict.spec.ts b/src/value/dict.test.ts similarity index 62% rename from src/value/dict.spec.ts rename to src/value/dict.test.ts index e729cbc..c41662b 100644 --- a/src/value/dict.spec.ts +++ b/src/value/dict.test.ts @@ -1,45 +1,49 @@ /* eslint-disable max-nested-callbacks */ +import {describe, it} from 'node:test'; +import {ok, strictEqual, throws} from 'node:assert'; + import {Value} from '../value'; import {ValueDict} from './dict'; -describe('value/dict', () => { - describe('ValueDict', () => { - describe('constructor', () => { - it('length: 0', () => { +void describe('value/dict', () => { + void describe('ValueDict', () => { + void describe('constructor', () => { + void it('length: 0', () => { const m = new Map(); const el = new ValueDict(m); - expect(el.value).toBe(m); + strictEqual(el.value, m); }); - it('length: 1', () => { + void it('length: 1', () => { const m = new Map(); m.set('<&>', new ValueDict()); const el = new ValueDict(m); - expect(el.value).toBe(m); + strictEqual(el.value, m); }); - it('length: 2', () => { + void it('length: 2', () => { const m = new Map(); m.set('something', new ValueDict()); m.set('<&>', new ValueDict()); const el = new ValueDict(m); - expect(el.value).toBe(m); + strictEqual(el.value, m); }); }); - describe('toXml', () => { - it('length: 0', () => { + void describe('toXml', () => { + void it('length: 0', () => { const el = new ValueDict(); - expect(el.toXml()).toBe(''); - expect(el.toXml(null, 1)).toBe('\t'); + strictEqual(el.toXml(), ''); + strictEqual(el.toXml(null, 1), '\t'); }); - it('length: 1', () => { + void it('length: 1', () => { const m = new Map(); m.set('<&>', new ValueDict()); const el = new ValueDict(m); - expect(el.toXml()).toBe( + strictEqual( + el.toXml(), [ '', '\t<&>', @@ -47,7 +51,8 @@ describe('value/dict', () => { '' ].join('\n') ); - expect(el.toXml(null, 1)).toBe( + strictEqual( + el.toXml(null, 1), [ '\t', '\t\t<&>', @@ -57,12 +62,13 @@ describe('value/dict', () => { ); }); - it('length: 2', () => { + void it('length: 2', () => { const m = new Map(); m.set('something', new ValueDict()); m.set('<&>', new ValueDict()); const el = new ValueDict(m); - expect(el.toXml()).toBe( + strictEqual( + el.toXml(), [ '', '\tsomething', @@ -72,7 +78,8 @@ describe('value/dict', () => { '' ].join('\n') ); - expect(el.toXml(null, 1)).toBe( + strictEqual( + el.toXml(null, 1), [ '\t', '\t\tsomething', @@ -85,14 +92,14 @@ describe('value/dict', () => { }); }); - describe('fromXml', () => { - it('size: 0', () => { + void describe('fromXml', () => { + void it('size: 0', () => { const el = new ValueDict(); el.fromXml(''); - expect(el.value.size).toBe(0); + strictEqual(el.value.size, 0); }); - it('size: 1', () => { + void it('size: 1', () => { const el = new ValueDict(); el.fromXml( [ @@ -102,11 +109,11 @@ describe('value/dict', () => { '' ].join('\n') ); - expect(el.value.size).toBe(1); - expect(el.value.get('<&>')).toBeTruthy(); + strictEqual(el.value.size, 1); + ok(el.value.get('<&>')); }); - it('size: 2', () => { + void it('size: 2', () => { const el = new ValueDict(); el.fromXml( [ @@ -118,33 +125,33 @@ describe('value/dict', () => { '' ].join('\n') ); - expect(el.value.size).toBe(2); - expect(el.value.get('test')).toBeTruthy(); - expect(el.value.get('<&>')).toBeTruthy(); + strictEqual(el.value.size, 2); + ok(el.value.get('test')); + ok(el.value.get('<&>')); }); - it('uneven elements', () => { + void it('uneven elements', () => { const el = new ValueDict(); - expect(() => { + throws(() => { el.fromXml('test'); - }).toThrow(); + }); }); - it('text', () => { + void it('text', () => { const el = new ValueDict(); - expect(() => { + throws(() => { el.fromXml('text'); - }).toThrow(); + }); }); - it('badtag', () => { + void it('badtag', () => { const el = new ValueDict(); - expect(() => { + throws(() => { el.fromXml(''); - }).toThrow(); - expect(() => { + }); + throws(() => { el.fromXml(''); - }).toThrow(); + }); }); }); }); diff --git a/src/value/integer.spec.ts b/src/value/integer.spec.ts deleted file mode 100644 index 2916439..0000000 --- a/src/value/integer.spec.ts +++ /dev/null @@ -1,189 +0,0 @@ -/* eslint-disable max-nested-callbacks */ -import {ValueInteger} from './integer'; - -const small = '9007199254740991'; -const smallPos = `+${small}`; -const smallNeg = `-${small}`; - -const big = '9007199254740992'; -const bigPos = `+${big}`; -const bigNeg = `-${big}`; -const supportsBigInt = typeof BigInt !== 'undefined'; - -describe('value/integer', () => { - describe('ValueInteger', () => { - describe('constructor', () => { - it('42', () => { - const el = new ValueInteger(42); - expect(el.value).toBe(42); - }); - - it('3.14', () => { - expect(() => new ValueInteger(3.14)).toThrow(); - }); - - it(small, () => { - const el = new ValueInteger(+small); - expect(el.value).toBe(+small); - }); - - it(smallPos, () => { - const el = new ValueInteger(+smallPos); - expect(el.value).toBe(+smallPos); - }); - - it(smallNeg, () => { - const el = new ValueInteger(+smallNeg); - expect(el.value).toBe(+smallNeg); - }); - - if (!supportsBigInt) { - return; - } - - it(big, () => { - const el = new ValueInteger(BigInt(big)); - expect(el.value).toBe(BigInt(big)); - }); - - it(bigPos, () => { - const el = new ValueInteger(BigInt(bigPos)); - expect(el.value).toBe(BigInt(bigPos)); - }); - - it(bigNeg, () => { - const el = new ValueInteger(BigInt(bigNeg)); - expect(el.value).toBe(BigInt(bigNeg)); - }); - }); - - describe('toXml', () => { - it('42', () => { - const el = new ValueInteger(42); - expect(el.toXml()).toBe('42'); - expect(el.toXml(null, 1)).toBe('\t42'); - }); - - it('3.14', () => { - const el = new ValueInteger(); - el.value = 3.14; - expect(() => el.toXml()).toThrow(); - }); - - it(small, () => { - const el = new ValueInteger(+small); - expect(el.toXml()).toBe(`${small}`); - expect(el.toXml(null, 1)).toBe(`\t${small}`); - }); - - it(smallPos, () => { - const el = new ValueInteger(+smallPos); - expect(el.toXml()).toBe(`${small}`); - expect(el.toXml(null, 1)).toBe(`\t${small}`); - }); - - it(smallNeg, () => { - const el = new ValueInteger(+smallNeg); - expect(el.toXml()).toBe(`${smallNeg}`); - expect(el.toXml(null, 1)).toBe( - `\t${smallNeg}` - ); - }); - - if (!supportsBigInt) { - return; - } - - it(big, () => { - const el = new ValueInteger(BigInt(big)); - expect(el.toXml()).toBe(`${big}`); - expect(el.toXml(null, 1)).toBe(`\t${big}`); - }); - - it(bigPos, () => { - const el = new ValueInteger(BigInt(bigPos)); - expect(el.toXml()).toBe(`${big}`); - expect(el.toXml(null, 1)).toBe(`\t${big}`); - }); - - it(bigNeg, () => { - const el = new ValueInteger(BigInt(bigNeg)); - expect(el.toXml()).toBe(`${bigNeg}`); - expect(el.toXml(null, 1)).toBe( - `\t${bigNeg}` - ); - }); - }); - - describe('fromXml', () => { - it('42', () => { - const el = new ValueInteger(); - el.fromXml('42'); - expect(el.value).toBe(42); - }); - - it('3.14', () => { - const el = new ValueInteger(); - expect(() => { - el.fromXml('3.14'); - }).toThrow(); - }); - - it('empty', () => { - const el = new ValueInteger(); - expect(() => { - el.fromXml(''); - }).toThrow(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - - it('baddata', () => { - const el = new ValueInteger(); - expect(() => { - el.fromXml('baddata'); - }).toThrow(); - }); - - it('children', () => { - const el = new ValueInteger(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - - it('badtag', () => { - const el = new ValueInteger(); - expect(() => { - el.fromXml(''); - }).toThrow(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - - if (!supportsBigInt) { - return; - } - - it(big, () => { - const el = new ValueInteger(); - el.fromXml(`${big}`); - expect(el.value).toBe(BigInt(big)); - }); - - it(bigPos, () => { - const el = new ValueInteger(); - el.fromXml(`${bigPos}`); - expect(el.value).toBe(BigInt(bigPos)); - }); - - it(bigNeg, () => { - const el = new ValueInteger(); - el.fromXml(`${bigNeg}`); - expect(el.value).toBe(BigInt(bigNeg)); - }); - }); - }); -}); diff --git a/src/value/integer.test.ts b/src/value/integer.test.ts new file mode 100644 index 0000000..25fa576 --- /dev/null +++ b/src/value/integer.test.ts @@ -0,0 +1,194 @@ +/* eslint-disable max-nested-callbacks */ +import {describe, it} from 'node:test'; +import {strictEqual, throws} from 'node:assert'; + +import {ValueInteger} from './integer'; + +const small = '9007199254740991'; +const smallPos = `+${small}`; +const smallNeg = `-${small}`; + +const big = '9007199254740992'; +const bigPos = `+${big}`; +const bigNeg = `-${big}`; +const supportsBigInt = typeof BigInt !== 'undefined'; + +void describe('value/integer', () => { + void describe('ValueInteger', () => { + void describe('constructor', () => { + void it('42', () => { + const el = new ValueInteger(42); + strictEqual(el.value, 42); + }); + + void it('3.14', () => { + throws(() => new ValueInteger(3.14)); + }); + + void it(small, () => { + const el = new ValueInteger(+small); + strictEqual(el.value, +small); + }); + + void it(smallPos, () => { + const el = new ValueInteger(+smallPos); + strictEqual(el.value, +smallPos); + }); + + void it(smallNeg, () => { + const el = new ValueInteger(+smallNeg); + strictEqual(el.value, +smallNeg); + }); + + if (!supportsBigInt) { + return; + } + + void it(big, () => { + const el = new ValueInteger(BigInt(big)); + strictEqual(el.value, BigInt(big)); + }); + + void it(bigPos, () => { + const el = new ValueInteger(BigInt(bigPos)); + strictEqual(el.value, BigInt(bigPos)); + }); + + void it(bigNeg, () => { + const el = new ValueInteger(BigInt(bigNeg)); + strictEqual(el.value, BigInt(bigNeg)); + }); + }); + + void describe('toXml', () => { + void it('42', () => { + const el = new ValueInteger(42); + strictEqual(el.toXml(), '42'); + strictEqual(el.toXml(null, 1), '\t42'); + }); + + void it('3.14', () => { + const el = new ValueInteger(); + el.value = 3.14; + throws(() => el.toXml()); + }); + + void it(small, () => { + const el = new ValueInteger(+small); + strictEqual(el.toXml(), `${small}`); + strictEqual(el.toXml(null, 1), `\t${small}`); + }); + + void it(smallPos, () => { + const el = new ValueInteger(+smallPos); + strictEqual(el.toXml(), `${small}`); + strictEqual(el.toXml(null, 1), `\t${small}`); + }); + + void it(smallNeg, () => { + const el = new ValueInteger(+smallNeg); + strictEqual(el.toXml(), `${smallNeg}`); + strictEqual( + el.toXml(null, 1), + `\t${smallNeg}` + ); + }); + + if (!supportsBigInt) { + return; + } + + void it(big, () => { + const el = new ValueInteger(BigInt(big)); + strictEqual(el.toXml(), `${big}`); + strictEqual(el.toXml(null, 1), `\t${big}`); + }); + + void it(bigPos, () => { + const el = new ValueInteger(BigInt(bigPos)); + strictEqual(el.toXml(), `${big}`); + strictEqual(el.toXml(null, 1), `\t${big}`); + }); + + void it(bigNeg, () => { + const el = new ValueInteger(BigInt(bigNeg)); + strictEqual(el.toXml(), `${bigNeg}`); + strictEqual( + el.toXml(null, 1), + `\t${bigNeg}` + ); + }); + }); + + void describe('fromXml', () => { + void it('42', () => { + const el = new ValueInteger(); + el.fromXml('42'); + strictEqual(el.value, 42); + }); + + void it('3.14', () => { + const el = new ValueInteger(); + throws(() => { + el.fromXml('3.14'); + }); + }); + + void it('empty', () => { + const el = new ValueInteger(); + throws(() => { + el.fromXml(''); + }); + throws(() => { + el.fromXml(''); + }); + }); + + void it('baddata', () => { + const el = new ValueInteger(); + throws(() => { + el.fromXml('baddata'); + }); + }); + + void it('children', () => { + const el = new ValueInteger(); + throws(() => { + el.fromXml(''); + }); + }); + + void it('badtag', () => { + const el = new ValueInteger(); + throws(() => { + el.fromXml(''); + }); + throws(() => { + el.fromXml(''); + }); + }); + + if (!supportsBigInt) { + return; + } + + void it(big, () => { + const el = new ValueInteger(); + el.fromXml(`${big}`); + strictEqual(el.value, BigInt(big)); + }); + + void it(bigPos, () => { + const el = new ValueInteger(); + el.fromXml(`${bigPos}`); + strictEqual(el.value, BigInt(bigPos)); + }); + + void it(bigNeg, () => { + const el = new ValueInteger(); + el.fromXml(`${bigNeg}`); + strictEqual(el.value, BigInt(bigNeg)); + }); + }); + }); +}); diff --git a/src/value/real.spec.ts b/src/value/real.spec.ts deleted file mode 100644 index 63f1aaf..0000000 --- a/src/value/real.spec.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* eslint-disable max-nested-callbacks */ -import {ValueReal} from './real'; - -describe('value/real', () => { - describe('ValueReal', () => { - describe('constructor', () => { - it('42', () => { - const el = new ValueReal(42); - expect(el.value).toBe(42); - }); - - it('3.14', () => { - const el = new ValueReal(3.14); - expect(el.value).toBe(3.14); - }); - }); - - describe('toXml', () => { - it('42', () => { - const el = new ValueReal(42); - expect(el.toXml()).toBe('42'); - expect(el.toXml(null, 1)).toBe('\t42'); - }); - - it('3.14', () => { - const el = new ValueReal(); - el.value = 3.14; - expect(el.toXml()).toBe('3.14'); - }); - }); - - describe('fromXml', () => { - it('42', () => { - const el = new ValueReal(); - el.fromXml('42'); - expect(el.value).toBe(42); - }); - - it('42.0', () => { - const el = new ValueReal(); - el.fromXml('42.0'); - expect(el.value).toBe(42); - }); - - it('3.14', () => { - const el = new ValueReal(); - el.fromXml('3.14'); - expect(el.value).toBe(3.14); - }); - - it('.14', () => { - const el = new ValueReal(); - el.fromXml('3.14'); - expect(el.value).toBe(3.14); - }); - - it('0.14', () => { - const el = new ValueReal(); - el.fromXml('0.14'); - expect(el.value).toBe(0.14); - }); - - it('-.14', () => { - const el = new ValueReal(); - el.fromXml('-.14'); - expect(el.value).toBe(-0.14); - }); - - it('+.14', () => { - const el = new ValueReal(); - el.fromXml('+.14'); - expect(el.value).toBe(0.14); - }); - - it('empty', () => { - const el = new ValueReal(); - expect(() => { - el.fromXml(''); - }).toThrow(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - - it('baddata', () => { - const el = new ValueReal(); - expect(() => { - el.fromXml('baddata'); - }).toThrow(); - expect(() => { - el.fromXml('1.'); - }).toThrow(); - }); - - it('children', () => { - const el = new ValueReal(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - - it('badtag', () => { - const el = new ValueReal(); - expect(() => { - el.fromXml(''); - }).toThrow(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - }); - }); -}); diff --git a/src/value/real.test.ts b/src/value/real.test.ts new file mode 100644 index 0000000..8e1de60 --- /dev/null +++ b/src/value/real.test.ts @@ -0,0 +1,116 @@ +/* eslint-disable max-nested-callbacks */ +import {describe, it} from 'node:test'; +import {strictEqual, throws} from 'node:assert'; + +import {ValueReal} from './real'; + +void describe('value/real', () => { + void describe('ValueReal', () => { + void describe('constructor', () => { + void it('42', () => { + const el = new ValueReal(42); + strictEqual(el.value, 42); + }); + + void it('3.14', () => { + const el = new ValueReal(3.14); + strictEqual(el.value, 3.14); + }); + }); + + void describe('toXml', () => { + void it('42', () => { + const el = new ValueReal(42); + strictEqual(el.toXml(), '42'); + strictEqual(el.toXml(null, 1), '\t42'); + }); + + void it('3.14', () => { + const el = new ValueReal(); + el.value = 3.14; + strictEqual(el.toXml(), '3.14'); + }); + }); + + void describe('fromXml', () => { + void it('42', () => { + const el = new ValueReal(); + el.fromXml('42'); + strictEqual(el.value, 42); + }); + + void it('42.0', () => { + const el = new ValueReal(); + el.fromXml('42.0'); + strictEqual(el.value, 42); + }); + + void it('3.14', () => { + const el = new ValueReal(); + el.fromXml('3.14'); + strictEqual(el.value, 3.14); + }); + + void it('.14', () => { + const el = new ValueReal(); + el.fromXml('3.14'); + strictEqual(el.value, 3.14); + }); + + void it('0.14', () => { + const el = new ValueReal(); + el.fromXml('0.14'); + strictEqual(el.value, 0.14); + }); + + void it('-.14', () => { + const el = new ValueReal(); + el.fromXml('-.14'); + strictEqual(el.value, -0.14); + }); + + void it('+.14', () => { + const el = new ValueReal(); + el.fromXml('+.14'); + strictEqual(el.value, 0.14); + }); + + void it('empty', () => { + const el = new ValueReal(); + throws(() => { + el.fromXml(''); + }); + throws(() => { + el.fromXml(''); + }); + }); + + void it('baddata', () => { + const el = new ValueReal(); + throws(() => { + el.fromXml('baddata'); + }); + throws(() => { + el.fromXml('1.'); + }); + }); + + void it('children', () => { + const el = new ValueReal(); + throws(() => { + el.fromXml(''); + }); + }); + + void it('badtag', () => { + const el = new ValueReal(); + throws(() => { + el.fromXml(''); + }); + throws(() => { + el.fromXml(''); + }); + }); + }); + }); +}); diff --git a/src/value/string.spec.ts b/src/value/string.spec.ts deleted file mode 100644 index 8518d83..0000000 --- a/src/value/string.spec.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* eslint-disable max-nested-callbacks */ -import {ValueString} from './string'; - -describe('value/string', () => { - describe('ValueString', () => { - describe('constructor', () => { - it('hello world', () => { - const el = new ValueString('hello world'); - expect(el.value).toBe('hello world'); - }); - - it('<&>', () => { - const el = new ValueString('<&>'); - expect(el.value).toBe('<&>'); - }); - }); - - describe('toXml', () => { - it('hello world', () => { - const el = new ValueString('hello world'); - expect(el.toXml()).toBe('hello world'); - expect(el.toXml(null, 1)).toBe( - '\thello world' - ); - }); - - it('<&>', () => { - const el = new ValueString('<&>'); - expect(el.toXml()).toBe('<&>'); - expect(el.toXml(null, 1)).toBe( - '\t<&>' - ); - }); - }); - - describe('fromXml', () => { - it('hello world', () => { - const el = new ValueString(''); - el.fromXml('hello world'); - expect(el.value).toBe('hello world'); - }); - - it('<&>', () => { - const el = new ValueString(''); - el.fromXml('<&>'); - expect(el.value).toBe('<&>'); - }); - - it('empty', () => { - const el = new ValueString('test'); - el.fromXml(''); - el.value = 'test'; - el.fromXml(''); - expect(el.value).toBe(''); - }); - - it('children', () => { - const el = new ValueString(''); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - - it('badtag', () => { - const el = new ValueString('test'); - expect(() => { - el.fromXml(''); - }).toThrow(); - expect(() => { - el.fromXml(''); - }).toThrow(); - }); - }); - }); -}); diff --git a/src/value/string.test.ts b/src/value/string.test.ts new file mode 100644 index 0000000..93f1497 --- /dev/null +++ b/src/value/string.test.ts @@ -0,0 +1,80 @@ +/* eslint-disable max-nested-callbacks */ +import {describe, it} from 'node:test'; +import {strictEqual, throws} from 'node:assert'; + +import {ValueString} from './string'; + +void describe('value/string', () => { + void describe('ValueString', () => { + void describe('constructor', () => { + void it('hello world', () => { + const el = new ValueString('hello world'); + strictEqual(el.value, 'hello world'); + }); + + void it('<&>', () => { + const el = new ValueString('<&>'); + strictEqual(el.value, '<&>'); + }); + }); + + void describe('toXml', () => { + void it('hello world', () => { + const el = new ValueString('hello world'); + strictEqual(el.toXml(), 'hello world'); + strictEqual( + el.toXml(null, 1), + '\thello world' + ); + }); + + void it('<&>', () => { + const el = new ValueString('<&>'); + strictEqual(el.toXml(), '<&>'); + strictEqual( + el.toXml(null, 1), + '\t<&>' + ); + }); + }); + + void describe('fromXml', () => { + void it('hello world', () => { + const el = new ValueString(''); + el.fromXml('hello world'); + strictEqual(el.value, 'hello world'); + }); + + void it('<&>', () => { + const el = new ValueString(''); + el.fromXml('<&>'); + strictEqual(el.value, '<&>'); + }); + + void it('empty', () => { + const el = new ValueString('test'); + el.fromXml(''); + el.value = 'test'; + el.fromXml(''); + strictEqual(el.value, ''); + }); + + void it('children', () => { + const el = new ValueString(''); + throws(() => { + el.fromXml(''); + }); + }); + + void it('badtag', () => { + const el = new ValueString('test'); + throws(() => { + el.fromXml(''); + }); + throws(() => { + el.fromXml(''); + }); + }); + }); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 65ecc79..965cc8d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "module": "commonjs", "moduleResolution": "Node", "allowSyntheticDefaultImports": true, - "lib": ["ESNext", "DOM"], + "lib": ["ESNext"], "newLine": "lf", "alwaysStrict": true, @@ -24,8 +24,8 @@ "declaration": true, "emitDeclarationOnly": true, - "types": ["node", "jasmine"], - "outDir": "lib" + "types": ["node"], + "outDir": "dts" }, - "include": ["src/**/*.ts"] + "include": ["src/**/*.ts", "src/**/*.tsx"] }