From 7de6254cb552e39fa35e4b1e1abe6c9bfeefd890 Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Wed, 29 Mar 2023 18:28:24 +0900 Subject: [PATCH] feat(bundle-utils): support esm/cjs dual package (#255) * feat(bundle-utils): support esm/cjs dual package * chore: add no hoist config * update --- .github/workflows/test.yml | 2 +- package.json | 11 +- packages/bundle-utils/build.config.ts | 16 + packages/bundle-utils/index.mjs | 1 - packages/bundle-utils/package.json | 19 +- packages/bundle-utils/src/codegen.ts | 22 +- packages/bundle-utils/src/deps.ts | 12 +- packages/bundle-utils/src/index.ts | 6 +- packages/bundle-utils/test/deps.test.ts | 9 +- .../__snapshots__/codegen.test.ts.snap | 82 ++-- .../generator/__snapshots__/js.test.ts.snap | 202 ++++---- .../generator/__snapshots__/json.test.ts.snap | 192 ++++---- .../__snapshots__/json5.test.ts.snap | 14 +- .../generator/__snapshots__/yaml.test.ts.snap | 170 +++---- packages/bundle-utils/tsconfig.json | 2 +- vitest.config.ts | 7 + yarn.lock | 450 +++++++++++++++++- 17 files changed, 842 insertions(+), 375 deletions(-) create mode 100644 packages/bundle-utils/build.config.ts delete mode 100644 packages/bundle-utils/index.mjs create mode 100644 vitest.config.ts diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d85b82f..ab6d32e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [14.16, 16] + node: [14.21, 16] steps: - name: Checkout uses: actions/checkout@v2 diff --git a/package.json b/package.json index 199617e..22b436e 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@types/json5": "^2.2.0", "@types/loader-utils": "^2.0.0", "@types/memory-fs": "^0.3.2", - "@types/node": "^15.12.4", + "@types/node": "^18.15.11", "@types/semver": "^7.3.6", "@types/webpack": "^4.41.26", "@types/webpack-merge": "^4.1.5", @@ -82,6 +82,7 @@ "ts-jest": "^27.0.5", "typescript": "^4.9.3", "vite": "^2.9.6", + "vitest": "^0.29.8", "vue": "^2.6.14", "vue-i18n": "beta", "vue-loader": "^16.3.0", @@ -139,14 +140,16 @@ "lint:eslint": "eslint ./packages ./scripts --ext .ts", "lint:eslint:fix": "yarn lint:eslint --fix", "lint:secret": "npx secretlint \"**/*\"", - "test": "yarn test:cover && yarn test:e2e", - "test:cover": "yarn test:unit --coverage", + "test": "yarn test:unit && yarn test:e2e", "test:e2e": "npm-run-all \"test:e2e:*\"", "test:e2e:rollup": "yarn workspace @intlify/rollup-plugin-vue-i18n test:e2e", "test:e2e:vite": "yarn workspace @intlify/vite-plugin-vue-i18n test:e2e", "test:e2e:webpack": "yarn workspace @intlify/vue-i18n-loader test:e2e", "test:e2e:unplugin": "yarn workspace @intlify/unplugin-vue-i18n test:e2e", - "test:unit": "NODE_ENV=test yarn run build:utils && jest --env node", + "test:unit": "run-s \"test:unit:*\"", + "test:unit:utils": "yarn run build:utils && vitest run packages/bundle-utils", + "test:unit:rollup": "NODE_ENV=test jest --env node packages/rollup-plugin-vue-i18n", + "test:unit:unplugin": "NODE_ENV=test jest --env node packages/unplugin-vue-i18n", "test:watch": "jest --env node --watch packages/bundle-utils/test/**", "changelog": "jiti ./scripts/changelog.ts", "changelog:utils": "yarn workspace @intlify/bundle-utils changelog", diff --git a/packages/bundle-utils/build.config.ts b/packages/bundle-utils/build.config.ts new file mode 100644 index 0000000..1849a61 --- /dev/null +++ b/packages/bundle-utils/build.config.ts @@ -0,0 +1,16 @@ +import { defineBuildConfig } from 'unbuild' + +export default defineBuildConfig({ + declaration: true, + outDir: 'lib', + entries: [ + { + name: 'index', + input: 'src/index' + } + ], + rollup: { + emitCJS: true + }, + externals: ['estree'] +}) diff --git a/packages/bundle-utils/index.mjs b/packages/bundle-utils/index.mjs deleted file mode 100644 index 4eb6093..0000000 --- a/packages/bundle-utils/index.mjs +++ /dev/null @@ -1 +0,0 @@ -export * from './lib/index.js' diff --git a/packages/bundle-utils/package.json b/packages/bundle-utils/package.json index cc2ef95..f1d0b2c 100644 --- a/packages/bundle-utils/package.json +++ b/packages/bundle-utils/package.json @@ -25,15 +25,17 @@ "estree-walker": "^2.0.2", "jsonc-eslint-parser": "^1.0.1", "magic-string": "^0.30.0", + "mlly": "^1.2.0", "source-map": "0.6.1", "yaml-eslint-parser": "^0.3.2" }, "devDependencies": { "@types/escodegen": "^0.0.7", - "@types/estree": "^1.0.0" + "@types/estree": "^1.0.0", + "unbuild": "^1.1.2" }, "engines": { - "node": ">= 12" + "node": ">= 14.16" }, "files": [ "lib", @@ -41,14 +43,14 @@ ], "homepage": "https://github.com/intlify/bundle-tools/blob/main/packages/bundle-utils/README.md", "license": "MIT", - "main": "lib/index.js", - "module": "./index.mjs", + "main": "lib/index.cjs", + "module": "lib/index.mjs", "types": "lib/index.d.ts", "exports": { ".": { - "import": "./index.mjs", - "require": "./lib/index.js", - "types": "./lib/index.d.ts" + "types": "./lib/index.d.ts", + "import": "./lib/index.mjs", + "require": "./lib/index.cjs" }, "./lib/*": "./lib/*", "./package.json": "./package.json" @@ -59,10 +61,9 @@ "directory": "packages/bundle-utils" }, "scripts": { - "build": "tsc -p .", + "build": "unbuild", "clean": "npm-run-all \"clean:*\"", "clean:lib": "rm -rf ./lib", - "watch": "tsc -p . --watch", "changelog": "jiti ../../scripts/changelog.ts", "release": "jiti ../../scripts/release.ts" } diff --git a/packages/bundle-utils/src/codegen.ts b/packages/bundle-utils/src/codegen.ts index 84502dc..0c25cf4 100644 --- a/packages/bundle-utils/src/codegen.ts +++ b/packages/bundle-utils/src/codegen.ts @@ -1,11 +1,4 @@ -import { - LocationStub, - baseCompile, - CompileError, - ResourceNode, - CompileOptions, - detectHtmlTag -} from '@intlify/message-compiler' +import module from 'node:module' import { SourceMapGenerator, SourceMapConsumer, @@ -15,6 +8,19 @@ import { import { format, escapeHtml as sanitizeHtml, isBoolean } from '@intlify/shared' import type { RawSourceMap } from 'source-map' +import type { + CompileError, + ResourceNode, + CompileOptions +} from '@intlify/message-compiler' + +// NOTE: use sourcemap (currently, `@intlify/message-compiler` support cjs pkg only) +const require = module.createRequire(import.meta.url) +const { + baseCompile, + detectHtmlTag, + LocationStub +} = require('@intlify/message-compiler') /** * Compilation dev environments diff --git a/packages/bundle-utils/src/deps.ts b/packages/bundle-utils/src/deps.ts index ddfb573..7dda647 100644 --- a/packages/bundle-utils/src/deps.ts +++ b/packages/bundle-utils/src/deps.ts @@ -1,5 +1,9 @@ +import module from 'node:module' + export type InstalledPackage = 'vue-i18n' | 'petite-vue-i18n' +const _require = module.createRequire(import.meta.url) + // eslint-disable-next-line @typescript-eslint/ban-types export function checkInstallPackage( pkg: string, @@ -7,7 +11,7 @@ export function checkInstallPackage( ): InstalledPackage { let installedVueI18n = false try { - debug(`vue-i18n load path: ${require.resolve('vue-i18n')}`) + debug(`vue-i18n load path: ${_require.resolve('vue-i18n')}`) installedVueI18n = true } catch (e) { debug(`cannot find 'vue-i18n'`, e) @@ -15,7 +19,7 @@ export function checkInstallPackage( let installedPetiteVueI18n = false try { - debug(`petite-vue-i18n load path: ${require.resolve('petite-vue-i18n')}`) + debug(`petite-vue-i18n load path: ${_require.resolve('petite-vue-i18n')}`) installedPetiteVueI18n = true } catch (e) { debug(`cannot find 'petite-vue-i18n'`, e) @@ -36,7 +40,7 @@ export function checkInstallPackage( export function checkVueI18nBridgeInstallPackage(debug: Function): boolean { let ret = false try { - debug(`vue-i18n-bridge load path: ${require.resolve('vue-i18n-bridge')}`) + debug(`vue-i18n-bridge load path: ${_require.resolve('vue-i18n-bridge')}`) ret = true } catch (e) { debug(`cannot find 'vue-i18n-bridge'`, e) @@ -63,7 +67,7 @@ export function getVueI18nVersion(debug: Function): VueI18nVersion { // eslint-disable-next-line @typescript-eslint/no-explicit-any export function loadModule(moduleName: string, debug: Function): any { try { - return require(moduleName) + return _require(moduleName) } catch (e) { debug(`cannot load '${moduleName}'`, e) return null diff --git a/packages/bundle-utils/src/index.ts b/packages/bundle-utils/src/index.ts index 3be19d4..0256582 100644 --- a/packages/bundle-utils/src/index.ts +++ b/packages/bundle-utils/src/index.ts @@ -1,10 +1,10 @@ -export { CodeGenOptions, CodeGenResult, DevEnv } from './codegen' export { generate as generateJSON } from './json' export { generate as generateYAML } from './yaml' export { generate as generateJavaScript } from './js' export { getVueI18nVersion, checkInstallPackage, - checkVueI18nBridgeInstallPackage, - InstalledPackage + checkVueI18nBridgeInstallPackage } from './deps' +export type { CodeGenOptions, CodeGenResult, DevEnv } from './codegen' +export type { InstalledPackage } from './deps' diff --git a/packages/bundle-utils/test/deps.test.ts b/packages/bundle-utils/test/deps.test.ts index a2e3849..4cb61ee 100644 --- a/packages/bundle-utils/test/deps.test.ts +++ b/packages/bundle-utils/test/deps.test.ts @@ -1,3 +1,4 @@ +import { vi } from 'vitest' import { checkInstallPackage, checkVueI18nBridgeInstallPackage, @@ -6,17 +7,17 @@ import { } from '../src/deps' test('vue-i18n', () => { - expect(checkInstallPackage('vue-i18n', jest.fn())).toBe('vue-i18n') + expect(checkInstallPackage('vue-i18n', vi.fn())).toBe('vue-i18n') }) test('vue-i18n-bridge', () => { - expect(checkVueI18nBridgeInstallPackage(jest.fn())).toBe(false) + expect(checkVueI18nBridgeInstallPackage(vi.fn())).toBe(false) }) test('loadModule', () => { - expect(loadModule('yaml-eslint-parser', jest.fn())).not.toBe(null) + expect(loadModule('yaml-eslint-parser', vi.fn())).not.toBe(null) }) test('getVueI18nVersion', () => { - expect(getVueI18nVersion(jest.fn())).toBe('9') + expect(getVueI18nVersion(vi.fn())).toBe('9') }) diff --git a/packages/bundle-utils/test/generator/__snapshots__/codegen.test.ts.snap b/packages/bundle-utils/test/generator/__snapshots__/codegen.test.ts.snap index 0c5891e..053f87c 100644 --- a/packages/bundle-utils/test/generator/__snapshots__/codegen.test.ts.snap +++ b/packages/bundle-utils/test/generator/__snapshots__/codegen.test.ts.snap @@ -1,20 +1,20 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`generateMessageFunction development 1`] = ` -Object { - "ast": Object { - "body": Object { +exports[`generateMessageFunction > development 1`] = ` +{ + "ast": { + "body": { "end": 5, - "items": Array [ - Object { + "items": [ + { "end": 5, - "loc": Object { - "end": Object { + "loc": { + "end": { "column": 6, "line": 1, "offset": 5, }, - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -25,13 +25,13 @@ Object { "value": "hello", }, ], - "loc": Object { - "end": Object { + "loc": { + "end": { "column": 6, "line": 1, "offset": 5, }, - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -41,17 +41,17 @@ Object { "type": 2, }, "end": 5, - "helpers": Array [ + "helpers": [ "normalize", ], - "loc": Object { - "end": Object { + "loc": { + "end": { "column": 6, "line": 1, "offset": 5, }, "source": "hello", - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -61,16 +61,16 @@ Object { "type": 0, }, "code": "(()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hello\\"])};fn.source=\\"hello\\";return fn;})()", - "errors": Array [], - "map": Object { + "errors": [], + "map": { "mappings": "mEAAAA", - "names": Array [ + "names": [ "hello", ], - "sources": Array [ + "sources": [ "message.intl", ], - "sourcesContent": Array [ + "sourcesContent": [ "hello", ], "version": 3, @@ -78,25 +78,25 @@ Object { } `; -exports[`generateMessageFunction escapeHtml default: should not be escaped 1`] = `"(()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"

hello

\\"])};fn.source=\\"

hello

\\";return fn;})()"`; +exports[`generateMessageFunction > escapeHtml > default: should not be escaped 1`] = `"(()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"

hello

\\"])};fn.source=\\"

hello

\\";return fn;})()"`; -exports[`generateMessageFunction escapeHtml true: should be escaped 1`] = `"(()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"<p>hello</p>\\"])};fn.source=\\"

hello

\\";return fn;})()"`; +exports[`generateMessageFunction > escapeHtml > true: should be escaped 1`] = `"(()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"<p>hello</p>\\"])};fn.source=\\"

hello

\\";return fn;})()"`; -exports[`generateMessageFunction production 1`] = ` -Object { - "ast": Object { - "body": Object { +exports[`generateMessageFunction > production 1`] = ` +{ + "ast": { + "body": { "end": 5, - "items": Array [ - Object { + "items": [ + { "end": 5, - "loc": Object { - "end": Object { + "loc": { + "end": { "column": 6, "line": 1, "offset": 5, }, - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -107,13 +107,13 @@ Object { "value": "hello", }, ], - "loc": Object { - "end": Object { + "loc": { + "end": { "column": 6, "line": 1, "offset": 5, }, - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -123,17 +123,17 @@ Object { "type": 2, }, "end": 5, - "helpers": Array [ + "helpers": [ "normalize", ], - "loc": Object { - "end": Object { + "loc": { + "end": { "column": 6, "line": 1, "offset": 5, }, "source": "hello", - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -143,7 +143,7 @@ Object { "type": 0, }, "code": "(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hello\\"])}", - "errors": Array [], + "errors": [], "map": undefined, } `; diff --git a/packages/bundle-utils/test/generator/__snapshots__/js.test.ts.snap b/packages/bundle-utils/test/generator/__snapshots__/js.test.ts.snap index 8e979d0..1394a50 100644 --- a/packages/bundle-utils/test/generator/__snapshots__/js.test.ts.snap +++ b/packages/bundle-utils/test/generator/__snapshots__/js.test.ts.snap @@ -1,31 +1,31 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`'allowDynamic' option generate: code 1`] = ` +exports[`'allowDynamic' option > generate > code 1`] = ` "const resource = { \\"hello\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"こんにちは\\"])};fn.source=\\"こんにちは\\";return fn;})() } export default resource" `; -exports[`'allowDynamic' option generate: map 1`] = ` -Object { +exports[`'allowDynamic' option > generate > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`'allowDynamic' option no generate 1`] = ` +exports[`'allowDynamic' option > no generate 1`] = ` Node { - "body": Array [ + "body": [ Node { "declaration": Node { "async": true, "body": Node { - "body": Array [ + "body": [ Node { - "declarations": Array [ + "declarations": [ Node { "end": 115, "id": Node { @@ -36,11 +36,11 @@ Node { }, "init": Node { "argument": Node { - "arguments": Array [ + "arguments": [ Node { "async": false, "body": Node { - "arguments": Array [], + "arguments": [], "callee": Node { "computed": false, "end": 112, @@ -69,7 +69,7 @@ Node { "expression": true, "generator": false, "id": null, - "params": Array [ + "params": [ Node { "end": 95, "name": "response", @@ -85,7 +85,7 @@ Node { "computed": false, "end": 86, "object": Node { - "arguments": Array [ + "arguments": [ Node { "end": 80, "name": "url", @@ -135,7 +135,7 @@ Node { Node { "argument": Node { "end": 136, - "properties": Array [ + "properties": [ Node { "argument": Node { "end": 134, @@ -169,7 +169,7 @@ Node { "start": 30, "type": "Identifier", }, - "params": Array [ + "params": [ Node { "end": 46, "name": "url", @@ -192,7 +192,7 @@ Node { } `; -exports[`array basic: code 1`] = ` +exports[`array basic > code 1`] = ` "export default function (Component) { const _Component = Component _Component.__i18n = _Component.__i18n || [] @@ -215,16 +215,16 @@ exports[`array basic: code 1`] = ` " `; -exports[`array basic: map 1`] = ` -Object { +exports[`array basic > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`array mixed: code 1`] = ` +exports[`array mixed > code 1`] = ` "export default function (Component) { const _Component = Component _Component.__i18n = _Component.__i18n || [] @@ -257,32 +257,32 @@ exports[`array mixed: code 1`] = ` " `; -exports[`array mixed: map 1`] = ` -Object { +exports[`array mixed > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`bare: code 1`] = ` +exports[`bare > code 1`] = ` "{ \\"hello\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hello world!\\"])};fn.source=\\"hello world!\\";return fn;})() }" `; -exports[`bare: map 1`] = ` -Object { +exports[`bare > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`bridge with ESM exporting: code 1`] = ` -"export default function (Component) { +exports[`bridge > code 1`] = ` +"module.exports = function (Component) { const _Component = Component.options || Component _Component.__i18n = _Component.__i18n || [] _Component.__i18n.push({ @@ -327,17 +327,17 @@ exports[`bridge with ESM exporting: code 1`] = ` " `; -exports[`bridge with ESM exporting: map 1`] = ` -Object { +exports[`bridge > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`bridge: code 1`] = ` -"module.exports = function (Component) { +exports[`bridge with ESM exporting > code 1`] = ` +"export default function (Component) { const _Component = Component.options || Component _Component.__i18n = _Component.__i18n || [] _Component.__i18n.push({ @@ -382,16 +382,16 @@ exports[`bridge: code 1`] = ` " `; -exports[`bridge: map 1`] = ` -Object { +exports[`bridge with ESM exporting > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`complex: code 1`] = ` +exports[`complex > code 1`] = ` "const resource = { \\"hi\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hi there!\\"])};fn.source=\\"hi there!\\";return fn;})(), \\"nested\\": { @@ -426,16 +426,16 @@ exports[`complex: code 1`] = ` export default resource" `; -exports[`complex: map 1`] = ` -Object { +exports[`complex > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`force stringify: code 1`] = ` +exports[`force stringify > code 1`] = ` "const resource = { \\"trueValue\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"true\\"])};fn.source=\\"true\\";return fn;})(), \\"falseValue\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"false\\"])};fn.source=\\"false\\";return fn;})(), @@ -459,30 +459,30 @@ exports[`force stringify: code 1`] = ` export default resource" `; -exports[`force stringify: map 1`] = ` -Object { +exports[`force stringify > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`html tag in message: code 1`] = ` +exports[`html tag in message > code 1`] = ` "{ \\"hi\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"<p>hi there!</p>\\"])};fn.source=\\"

hi there!

\\";return fn;})(), \\"alert\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"<script>window.alert('hi there!')</script>\\"])};fn.source=\\"\\";return fn;})() }" `; -exports[`html tag in message: errors 1`] = ` -Array [ - Object { +exports[`html tag in message > errors 1`] = ` +[ + { "msg": "Detected HTML in '

hi there!

' message.", "path": "hi", "source": "

hi there!

", }, - Object { + { "msg": "Detected HTML in '' message.", "path": "alert", "source": "", @@ -490,7 +490,7 @@ Array [ ] `; -exports[`include function: code 1`] = ` +exports[`include function > code 1`] = ` "const resource = { \\"hello\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hello\\"])};fn.source=\\"hello\\";return fn;})(), \\"pagination\\": { @@ -504,16 +504,16 @@ exports[`include function: code 1`] = ` export default resource" `; -exports[`include function: map 1`] = ` -Object { +exports[`include function > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`invalid message syntax: code 1`] = ` +exports[`invalid message syntax > code 1`] = ` "{ \\"hello\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"こんにちは\\"])};fn.source=\\"こんにちは\\";return fn;})(), \\"this-is-ivalid\\": @, @@ -527,18 +527,18 @@ exports[`invalid message syntax: code 1`] = ` }" `; -exports[`invalid message syntax: errors 1`] = ` -Array [ - Object { +exports[`invalid message syntax > errors 1`] = ` +[ + { "code": 14, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -548,16 +548,16 @@ Array [ "path": "this-is-ivalid", "source": "@", }, - Object { + { "code": 13, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 2, "line": 1, "offset": 1, @@ -567,16 +567,16 @@ Array [ "path": "this-is-ivalid", "source": "@", }, - Object { + { "code": 14, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -586,16 +586,16 @@ Array [ "path": "nested.array.0.this-is-ivalid", "source": "@", }, - Object { + { "code": 13, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 2, "line": 1, "offset": 1, @@ -608,16 +608,16 @@ Array [ ] `; -exports[`invalid message syntax: map 1`] = ` -Object { +exports[`invalid message syntax > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`simple: code 1`] = ` +exports[`simple > code 1`] = ` "const resource = { \\"hi\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hi there!\\"])};fn.source=\\"hi there!\\";return fn;})(), \\"hello\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hello world!\\"])};fn.source=\\"hello world!\\";return fn;})(), @@ -630,16 +630,16 @@ exports[`simple: code 1`] = ` export default resource" `; -exports[`simple: map 1`] = ` -Object { +exports[`simple > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`unhandling: code 1`] = ` +exports[`unhandling > code 1`] = ` "const resource = { \\"trueValue\\": true, \\"falseValue\\": false, @@ -663,16 +663,16 @@ exports[`unhandling: code 1`] = ` export default resource" `; -exports[`unhandling: map 1`] = ` -Object { +exports[`unhandling > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`useClassComponent: code 1`] = ` +exports[`useClassComponent > code 1`] = ` "export default function (Component) { const _Component = Component.__o || Component _Component.__i18n = _Component.__i18n || [] @@ -714,11 +714,11 @@ exports[`useClassComponent: code 1`] = ` " `; -exports[`useClassComponent: map 1`] = ` -Object { +exports[`useClassComponent > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; diff --git a/packages/bundle-utils/test/generator/__snapshots__/json.test.ts.snap b/packages/bundle-utils/test/generator/__snapshots__/json.test.ts.snap index dd3e898..17e7f10 100644 --- a/packages/bundle-utils/test/generator/__snapshots__/json.test.ts.snap +++ b/packages/bundle-utils/test/generator/__snapshots__/json.test.ts.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`array basic: code 1`] = ` +exports[`array basic > code 1`] = ` "export default function (Component) { const _Component = Component _Component.__i18n = _Component.__i18n || [] @@ -23,17 +23,17 @@ exports[`array basic: code 1`] = ` " `; -exports[`array basic: map 1`] = ` -Object { +exports[`array basic > map 1`] = ` +{ "mappings": ";6EACUA,SAASC", - "names": Array [ + "names": [ "bar", "baz", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ \\"foo\\": [[\\"bar\\"], [\\"baz\\"]] } @@ -43,7 +43,7 @@ Object { } `; -exports[`array mixed: code 1`] = ` +exports[`array mixed > code 1`] = ` "export default function (Component) { const _Component = Component _Component.__i18n = _Component.__i18n || [] @@ -76,20 +76,20 @@ exports[`array mixed: code 1`] = ` " `; -exports[`array mixed: map 1`] = ` -Object { +exports[`array mixed > map 1`] = ` +{ "mappings": ";;;+EAGYA;;;wEAGPC;;;mFAGWD;;0EAETE;;;sEAGJC;uEACCC", - "names": Array [ + "names": [ "foo", "bar", "hoge", "baz", "buz", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ \\"foo\\": [ { @@ -114,22 +114,22 @@ Object { } `; -exports[`bare: code 1`] = ` +exports[`bare > code 1`] = ` "{ \\"hello\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hello world!\\"])};fn.source=\\"hello world!\\";return fn;})() }" `; -exports[`bare: map 1`] = ` -Object { +exports[`bare > map 1`] = ` +{ "mappings": ";6EACUA", - "names": Array [ + "names": [ "hello world!", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ \\"hello\\": \\"hello world!\\" } @@ -139,8 +139,8 @@ Object { } `; -exports[`bridge with ESM exporting: code 1`] = ` -"export default function (Component) { +exports[`bridge > code 1`] = ` +"module.exports = function (Component) { const _Component = Component.options || Component _Component.__i18n = _Component.__i18n || [] _Component.__i18n.push({ @@ -210,10 +210,10 @@ exports[`bridge with ESM exporting: code 1`] = ` " `; -exports[`bridge with ESM exporting: map 1`] = ` -Object { +exports[`bridge > map 1`] = ` +{ "mappings": ";0EACOA;;+EAEKC;;yMAEGC,aAAAC,8BAAAC,wBAAAC,wBAAAC,2BAAAC;;sHAEJC,QAAAJ,wBAAAK;;6EAEDC;oFACOC;6EACPC;+EACEC;sFACOC;8FACQC;2FACHC;+EACZC,aAAaC;;;wEAGpBC;;oIAEkBC,YAAAC,8BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "no apples", @@ -238,10 +238,10 @@ Object { "type", " warining", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ \\"hi\\": \\"hi there!\\", \\"nested\\": { @@ -274,8 +274,8 @@ Object { } `; -exports[`bridge: code 1`] = ` -"module.exports = function (Component) { +exports[`bridge with ESM exporting > code 1`] = ` +"export default function (Component) { const _Component = Component.options || Component _Component.__i18n = _Component.__i18n || [] _Component.__i18n.push({ @@ -345,10 +345,10 @@ exports[`bridge: code 1`] = ` " `; -exports[`bridge: map 1`] = ` -Object { +exports[`bridge with ESM exporting > map 1`] = ` +{ "mappings": ";0EACOA;;+EAEKC;;yMAEGC,aAAAC,8BAAAC,wBAAAC,wBAAAC,2BAAAC;;sHAEJC,QAAAJ,wBAAAK;;6EAEDC;oFACOC;6EACPC;+EACEC;sFACOC;8FACQC;2FACHC;+EACZC,aAAaC;;;wEAGpBC;;oIAEkBC,YAAAC,8BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "no apples", @@ -373,10 +373,10 @@ Object { "type", " warining", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ \\"hi\\": \\"hi there!\\", \\"nested\\": { @@ -409,7 +409,7 @@ Object { } `; -exports[`complex: code 1`] = ` +exports[`complex > code 1`] = ` "const resource = { \\"hi\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hi there!\\"])};fn.source=\\"hi there!\\";return fn;})(), \\"nested\\": { @@ -443,10 +443,10 @@ exports[`complex: code 1`] = ` export default resource" `; -exports[`complex: map 1`] = ` -Object { +exports[`complex > map 1`] = ` +{ "mappings": ";0EACOA;;+EAEKC;;yMAEGC,aAAAC,8BAAAC,wBAAAC,wBAAAC,2BAAAC;;sHAEJC,QAAAJ,wBAAAK;;6EAEDC;oFACOC;6EACPC;+EACEC;sFACOC;8FACQC;2FACHC;+EACZC,aAAaC;;;wEAGpBC;;oIAEkBC,YAAAC,8BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "no apples", @@ -471,10 +471,10 @@ Object { "type", " warining", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ \\"hi\\": \\"hi there!\\", \\"nested\\": { @@ -507,7 +507,7 @@ Object { } `; -exports[`force stringify: code 1`] = ` +exports[`force stringify > code 1`] = ` "const resource = { \\"trueValue\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"true\\"])};fn.source=\\"true\\";return fn;})(), \\"falseValue\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"false\\"])};fn.source=\\"false\\";return fn;})(), @@ -517,19 +517,19 @@ exports[`force stringify: code 1`] = ` export default resource" `; -exports[`force stringify: map 1`] = ` -Object { +exports[`force stringify > map 1`] = ` +{ "mappings": ";iFACcA;kFACCC;iFACDC;mFACEC", - "names": Array [ + "names": [ "true", "false", "null", "1", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ \\"trueValue\\": true, \\"falseValue\\": false, @@ -542,21 +542,21 @@ Object { } `; -exports[`html tag in message: code 1`] = ` +exports[`html tag in message > code 1`] = ` "{ \\"hi\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"<p>hi there!</p>\\"])};fn.source=\\"

hi there!

\\";return fn;})(), \\"alert\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"<script>window.alert('hi there!')</script>\\"])};fn.source=\\"\\";return fn;})() }" `; -exports[`html tag in message: errors 1`] = ` -Array [ - Object { +exports[`html tag in message > errors 1`] = ` +[ + { "msg": "Detected HTML in '

hi there!

' message.", "path": "hi", "source": "

hi there!

", }, - Object { + { "msg": "Detected HTML in '' message.", "path": "alert", "source": "", @@ -564,7 +564,7 @@ Array [ ] `; -exports[`invalid message syntax: code 1`] = ` +exports[`invalid message syntax > code 1`] = ` "{ \\"hello\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"こんにちは\\"])};fn.source=\\"こんにちは\\";return fn;})(), \\"this-is-ivalid\\": @, @@ -578,18 +578,18 @@ exports[`invalid message syntax: code 1`] = ` }" `; -exports[`invalid message syntax: errors 1`] = ` -Array [ - Object { +exports[`invalid message syntax > errors 1`] = ` +[ + { "code": 14, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -599,16 +599,16 @@ Array [ "path": "this-is-ivalid", "source": "@", }, - Object { + { "code": 13, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 2, "line": 1, "offset": 1, @@ -618,16 +618,16 @@ Array [ "path": "this-is-ivalid", "source": "@", }, - Object { + { "code": 14, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -637,16 +637,16 @@ Array [ "path": "nested.array.0.this-is-ivalid", "source": "@", }, - Object { + { "code": 13, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 2, "line": 1, "offset": 1, @@ -659,17 +659,17 @@ Array [ ] `; -exports[`invalid message syntax: map 1`] = ` -Object { +exports[`invalid message syntax > map 1`] = ` +{ "mappings": ";6EACUA;4HACSC;;;;kIAIMA", - "names": Array [ + "names": [ "こんにちは", "", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ \\"hello\\": \\"こんにちは\\", \\"this-is-ivalid\\": \\"@\\", @@ -687,7 +687,7 @@ Object { } `; -exports[`legacy: code 1`] = ` +exports[`legacy > code 1`] = ` "export default function (Component) { Component.options.__i18n = Component.options.__i18n || [] Component.options.__i18n.push(\\"{\\\\\\"hi\\\\\\":\\\\\\"hi there!\\\\\\",\\\\\\"nested\\\\\\":{\\\\\\"hello\\\\\\":\\\\\\"hello world!\\\\\\",\\\\\\"more\\\\\\":{\\\\\\"plural\\\\\\":\\\\\\"@.caml:{\\\\\\\\u0027no apples\\\\\\\\u0027} | {0} apple | {n} apples\\\\\\"},\\\\\\"list\\\\\\":\\\\\\"hi, {0} !\\\\\\"},\\\\\\"こんにちは\\\\\\":\\\\\\"こんにちは!\\\\\\",\\\\\\"single-quote\\\\\\":\\\\\\"I don\\\\\\\\u0027t know!\\\\\\",\\\\\\"emoji\\\\\\":\\\\\\"😺\\\\\\",\\\\\\"unicode\\\\\\":\\\\\\"A\\\\\\",\\\\\\"unicode-escape\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\u0041\\\\\\",\\\\\\"backslash-single-quote\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\u0027\\\\\\",\\\\\\"backslash-backslash\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\"errors\\\\\\":[\\\\\\"ERROR1001\\\\\\",\\\\\\"ERROR1002\\\\\\"],\\\\\\"complex\\\\\\":{\\\\\\"warnings\\\\\\":[\\\\\\"NOTE: This is warning\\\\\\",{\\\\\\"named-waring\\\\\\":\\\\\\"this is {type} warining\\\\\\"}]}}\\") @@ -695,12 +695,12 @@ exports[`legacy: code 1`] = ` }" `; -exports[`legacy: map 1`] = ` +exports[`legacy > map 1`] = ` SourceMap { "file": "vue-i18n-loader.json", "mappings": "AAAA;AACA;AACA;AACA;AACA", - "names": Array [], - "sources": Array [ + "names": [], + "sources": [ "{ \\"hi\\": \\"hi there!\\", \\"nested\\": { @@ -729,7 +729,7 @@ SourceMap { } ", ], - "sourcesContent": Array [ + "sourcesContent": [ "export default function (Component) { Component.options.__i18n = Component.options.__i18n || [] Component.options.__i18n.push(\\"{\\\\\\"hi\\\\\\":\\\\\\"hi there!\\\\\\",\\\\\\"nested\\\\\\":{\\\\\\"hello\\\\\\":\\\\\\"hello world!\\\\\\",\\\\\\"more\\\\\\":{\\\\\\"plural\\\\\\":\\\\\\"@.caml:{\\\\\\\\u0027no apples\\\\\\\\u0027} | {0} apple | {n} apples\\\\\\"},\\\\\\"list\\\\\\":\\\\\\"hi, {0} !\\\\\\"},\\\\\\"こんにちは\\\\\\":\\\\\\"こんにちは!\\\\\\",\\\\\\"single-quote\\\\\\":\\\\\\"I don\\\\\\\\u0027t know!\\\\\\",\\\\\\"emoji\\\\\\":\\\\\\"😺\\\\\\",\\\\\\"unicode\\\\\\":\\\\\\"A\\\\\\",\\\\\\"unicode-escape\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\u0041\\\\\\",\\\\\\"backslash-single-quote\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\u0027\\\\\\",\\\\\\"backslash-backslash\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\"errors\\\\\\":[\\\\\\"ERROR1001\\\\\\",\\\\\\"ERROR1002\\\\\\"],\\\\\\"complex\\\\\\":{\\\\\\"warnings\\\\\\":[\\\\\\"NOTE: This is warning\\\\\\",{\\\\\\"named-waring\\\\\\":\\\\\\"this is {type} warining\\\\\\"}]}}\\") @@ -740,7 +740,7 @@ SourceMap { } `; -exports[`simple: code 1`] = ` +exports[`simple > code 1`] = ` "const resource = { \\"hi\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hi there!\\"])};fn.source=\\"hi there!\\";return fn;})(), \\"hello\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hello world!\\"])};fn.source=\\"hello world!\\";return fn;})(), @@ -753,10 +753,10 @@ exports[`simple: code 1`] = ` export default resource" `; -exports[`simple: map 1`] = ` -Object { +exports[`simple > map 1`] = ` +{ "mappings": ";0EACOA;6EACGC;uHACAC,QAAAC,8BAAAC;oHACDF,QAAAG,wBAAAD;+EACGF,QAAAI,WAAAF;4GACDF,gBAAAC,2BAAAC;qMACAG,aAAAC,8BAAAH,wBAAAI,wBAAAC,2BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "hi, ", @@ -770,10 +770,10 @@ Object { "n", " apples", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ \\"hi\\": \\"hi there!\\", \\"hello\\": \\"hello world!\\", @@ -789,7 +789,7 @@ Object { } `; -exports[`unhandling: code 1`] = ` +exports[`unhandling > code 1`] = ` "const resource = { \\"trueValue\\": true, \\"falseValue\\": false, @@ -799,16 +799,16 @@ exports[`unhandling: code 1`] = ` export default resource" `; -exports[`unhandling: map 1`] = ` -Object { +exports[`unhandling > map 1`] = ` +{ "mappings": "", - "names": Array [], - "sources": Array [], + "names": [], + "sources": [], "version": 3, } `; -exports[`useClassComponent: code 1`] = ` +exports[`useClassComponent > code 1`] = ` "export default function (Component) { const _Component = Component.__o || Component _Component.__i18n = _Component.__i18n || [] @@ -849,10 +849,10 @@ exports[`useClassComponent: code 1`] = ` " `; -exports[`useClassComponent: map 1`] = ` -Object { +exports[`useClassComponent > map 1`] = ` +{ "mappings": ";0EACOA;;+EAEKC;;yMAEGC,aAAAC,8BAAAC,wBAAAC,wBAAAC,2BAAAC;;sHAEJC,QAAAJ,wBAAAK;;6EAEDC;oFACOC;6EACPC;+EACEC;sFACOC;8FACQC;2FACHC;+EACZC,aAAaC;;;wEAGpBC;;oIAEkBC,YAAAC,8BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "no apples", @@ -877,10 +877,10 @@ Object { "type", " warining", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ \\"hi\\": \\"hi there!\\", \\"nested\\": { diff --git a/packages/bundle-utils/test/generator/__snapshots__/json5.test.ts.snap b/packages/bundle-utils/test/generator/__snapshots__/json5.test.ts.snap index fe05f6a..5d1008a 100644 --- a/packages/bundle-utils/test/generator/__snapshots__/json5.test.ts.snap +++ b/packages/bundle-utils/test/generator/__snapshots__/json5.test.ts.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`json5: code 1`] = ` +exports[`json5 > code 1`] = ` "const resource = { \\"hi\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hi there!\\"])};fn.source=\\"hi there!\\";return fn;})(), \\"nested\\": { @@ -34,10 +34,10 @@ exports[`json5: code 1`] = ` export default resource" `; -exports[`json5: map 1`] = ` -Object { +exports[`json5 > map 1`] = ` +{ "mappings": ";wEACKA;;6EAEKC;;uMAEGC,aAAAC,8BAAAC,wBAAAC,wBAAAC,2BAAAC;;oHAEJC,QAAAJ,wBAAAK;;;6EAGCC;oFACOC;2EACTC;6EACEC;sFACSC;8FACQC;2FACHC;;sEAErBC,aAAaC;;;;wEAIXC;;oIAEkBC,YAAAC,8BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "no apples", @@ -62,10 +62,10 @@ Object { "type", " warining", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.json", ], - "sourcesContent": Array [ + "sourcesContent": [ "{ hi: \\"hi there!\\", nested: { diff --git a/packages/bundle-utils/test/generator/__snapshots__/yaml.test.ts.snap b/packages/bundle-utils/test/generator/__snapshots__/yaml.test.ts.snap index 164c010..5211e86 100644 --- a/packages/bundle-utils/test/generator/__snapshots__/yaml.test.ts.snap +++ b/packages/bundle-utils/test/generator/__snapshots__/yaml.test.ts.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`array basic: code 1`] = ` +exports[`array basic > code 1`] = ` "export default function (Component) { const _Component = Component _Component.__i18n = _Component.__i18n || [] @@ -22,17 +22,17 @@ exports[`array basic: code 1`] = ` }" `; -exports[`array basic: map 1`] = ` -Object { +exports[`array basic > map 1`] = ` +{ "mappings": ";wEACKA;wEACAC", - "names": Array [ + "names": [ "bar", "baz", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.yaml", ], - "sourcesContent": Array [ + "sourcesContent": [ "foo: - - bar - - baz @@ -42,7 +42,7 @@ Object { } `; -exports[`array mixed: code 1`] = ` +exports[`array mixed > code 1`] = ` "export default function (Component) { const _Component = Component _Component.__i18n = _Component.__i18n || [] @@ -74,20 +74,20 @@ exports[`array mixed: code 1`] = ` }" `; -exports[`array mixed: map 1`] = ` -Object { +exports[`array mixed > map 1`] = ` +{ "mappings": ";2EACQA;wEACHC;+EACOD;0EACLE;sEACJC;wEACEC", - "names": Array [ + "names": [ "foo", "bar", "hoge", "baz", "buz", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.yaml", ], - "sourcesContent": Array [ + "sourcesContent": [ "foo: - foo: 'foo' - - bar @@ -101,22 +101,22 @@ Object { } `; -exports[`bare: code 1`] = ` +exports[`bare > code 1`] = ` "{ \\"hello\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hello world!\\"])};fn.source=\\"hello world!\\";return fn;})() }" `; -exports[`bare: map 1`] = ` -Object { +exports[`bare > map 1`] = ` +{ "mappings": "yEAAMA", - "names": Array [ + "names": [ "hello world!", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.yaml", ], - "sourcesContent": Array [ + "sourcesContent": [ "hello: hello world! ", ], @@ -124,8 +124,8 @@ Object { } `; -exports[`bridge with ESM exporting: code 1`] = ` -"export default function (Component) { +exports[`bridge > code 1`] = ` +"module.exports = function (Component) { const _Component = Component.options || Component _Component.__i18n = _Component.__i18n || [] _Component.__i18n.push({ @@ -194,10 +194,10 @@ exports[`bridge with ESM exporting: code 1`] = ` }" `; -exports[`bridge with ESM exporting: map 1`] = ` -Object { +exports[`bridge > map 1`] = ` +{ "mappings": "sEAAGA;;6EAEOC;;qMAECC,aAAAC,8BAAAC,wBAAAC,wBAAAC,2BAAAC;kHACJC,QAAAJ,wBAAAK;yEACDC;gFACOC;yEACPC;2EACEC;kFACOC;0FACQC;uFACHC;;sEAEjBC;sEACAC;;;wEAGEC;gIACcC,YAAAC,8BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "no apples", @@ -222,10 +222,10 @@ Object { "type", " warining", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.yaml", ], - "sourcesContent": Array [ + "sourcesContent": [ "hi: hi there! nested: \\"hello\\": \\"hello world!\\" @@ -252,8 +252,8 @@ complex: } `; -exports[`bridge: code 1`] = ` -"module.exports = function (Component) { +exports[`bridge with ESM exporting > code 1`] = ` +"export default function (Component) { const _Component = Component.options || Component _Component.__i18n = _Component.__i18n || [] _Component.__i18n.push({ @@ -322,10 +322,10 @@ exports[`bridge: code 1`] = ` }" `; -exports[`bridge: map 1`] = ` -Object { +exports[`bridge with ESM exporting > map 1`] = ` +{ "mappings": "sEAAGA;;6EAEOC;;qMAECC,aAAAC,8BAAAC,wBAAAC,wBAAAC,2BAAAC;kHACJC,QAAAJ,wBAAAK;yEACDC;gFACOC;yEACPC;2EACEC;kFACOC;0FACQC;uFACHC;;sEAEjBC;sEACAC;;;wEAGEC;gIACcC,YAAAC,8BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "no apples", @@ -350,10 +350,10 @@ Object { "type", " warining", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.yaml", ], - "sourcesContent": Array [ + "sourcesContent": [ "hi: hi there! nested: \\"hello\\": \\"hello world!\\" @@ -380,21 +380,21 @@ complex: } `; -exports[`html tag in message: code 1`] = ` +exports[`html tag in message > code 1`] = ` "{ \\"hi\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"<p>hi there!</p>\\"])};fn.source=\\"

hi there!

\\";return fn;})(), \\"alert\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"<script>window.alert('hi there!')</script>\\"])};fn.source=\\"\\";return fn;})() }" `; -exports[`html tag in message: errors 1`] = ` -Array [ - Object { +exports[`html tag in message > errors 1`] = ` +[ + { "msg": "Detected HTML in '

hi there!

' message.", "path": "hi", "source": "

hi there!

", }, - Object { + { "msg": "Detected HTML in '' message.", "path": "alert", "source": "", @@ -402,7 +402,7 @@ Array [ ] `; -exports[`invalid message syntax: code 1`] = ` +exports[`invalid message syntax > code 1`] = ` "{ \\"hello\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"こんにちは\\"])};fn.source=\\"こんにちは\\";return fn;})(), \\"this-is-ivalid\\": @, @@ -416,18 +416,18 @@ exports[`invalid message syntax: code 1`] = ` }" `; -exports[`invalid message syntax: errors 1`] = ` -Array [ - Object { +exports[`invalid message syntax > errors 1`] = ` +[ + { "code": 14, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -437,16 +437,16 @@ Array [ "path": "this-is-ivalid", "source": "@", }, - Object { + { "code": 13, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 2, "line": 1, "offset": 1, @@ -456,16 +456,16 @@ Array [ "path": "this-is-ivalid", "source": "@", }, - Object { + { "code": 14, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 1, "line": 1, "offset": 0, @@ -475,16 +475,16 @@ Array [ "path": "nested.array.0.this-is-ivalid", "source": "@", }, - Object { + { "code": 13, "domain": "parser", - "location": Object { - "end": Object { + "location": { + "end": { "column": 2, "line": 1, "offset": 1, }, - "start": Object { + "start": { "column": 2, "line": 1, "offset": 1, @@ -497,17 +497,17 @@ Array [ ] `; -exports[`invalid message syntax: map 1`] = ` -Object { +exports[`invalid message syntax > map 1`] = ` +{ "mappings": "yEAAMA;wHACSC;;;8HAGMA", - "names": Array [ + "names": [ "こんにちは", "", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.yaml", ], - "sourcesContent": Array [ + "sourcesContent": [ "hello: こんにちは this-is-ivalid: '@' # is this ivalid? nested: @@ -519,7 +519,7 @@ nested: } `; -exports[`legacy: code 1`] = ` +exports[`legacy > code 1`] = ` "export default function (Component) { Component.options.__i18n = Component.options.__i18n || [] Component.options.__i18n.push(\\"{\\\\\\"hi\\\\\\":\\\\\\"hi there!\\\\\\",\\\\\\"nested\\\\\\":{\\\\\\"hello\\\\\\":\\\\\\"hello world!\\\\\\",\\\\\\"more\\\\\\":{\\\\\\"plural\\\\\\":\\\\\\"@.caml:{\\\\\\\\u0027no apples\\\\\\\\u0027} | {0} apple | {n} apples\\\\\\"},\\\\\\"list\\\\\\":\\\\\\"hi, {0} !\\\\\\"},\\\\\\"こんにちは\\\\\\":\\\\\\"こんにちは!\\\\\\",\\\\\\"single-quote\\\\\\":\\\\\\"I don\\\\\\\\u0027t know!\\\\\\",\\\\\\"emoji\\\\\\":\\\\\\"😺\\\\\\",\\\\\\"unicode\\\\\\":\\\\\\"A\\\\\\",\\\\\\"unicode-escape\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\u0041\\\\\\",\\\\\\"backslash-single-quote\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\u0027\\\\\\",\\\\\\"backslash-backslash\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\"errors\\\\\\":[\\\\\\"ERROR1001\\\\\\",\\\\\\"ERROR1002\\\\\\"],\\\\\\"complex\\\\\\":{\\\\\\"warnings\\\\\\":[\\\\\\"NOTE: This is warning\\\\\\",{\\\\\\"named-waring\\\\\\":\\\\\\"this is {type} warining\\\\\\"}]}}\\") @@ -527,12 +527,12 @@ exports[`legacy: code 1`] = ` }" `; -exports[`legacy: map 1`] = ` +exports[`legacy > map 1`] = ` SourceMap { "file": "vue-i18n-loader.yaml", "mappings": "AAAA;AACA;AACA;AACA;AACA", - "names": Array [], - "sources": Array [ + "names": [], + "sources": [ "hi: hi there! nested: \\"hello\\": \\"hello world!\\" @@ -555,7 +555,7 @@ complex: - named-waring: \\"this is {type} warining\\" ", ], - "sourcesContent": Array [ + "sourcesContent": [ "export default function (Component) { Component.options.__i18n = Component.options.__i18n || [] Component.options.__i18n.push(\\"{\\\\\\"hi\\\\\\":\\\\\\"hi there!\\\\\\",\\\\\\"nested\\\\\\":{\\\\\\"hello\\\\\\":\\\\\\"hello world!\\\\\\",\\\\\\"more\\\\\\":{\\\\\\"plural\\\\\\":\\\\\\"@.caml:{\\\\\\\\u0027no apples\\\\\\\\u0027} | {0} apple | {n} apples\\\\\\"},\\\\\\"list\\\\\\":\\\\\\"hi, {0} !\\\\\\"},\\\\\\"こんにちは\\\\\\":\\\\\\"こんにちは!\\\\\\",\\\\\\"single-quote\\\\\\":\\\\\\"I don\\\\\\\\u0027t know!\\\\\\",\\\\\\"emoji\\\\\\":\\\\\\"😺\\\\\\",\\\\\\"unicode\\\\\\":\\\\\\"A\\\\\\",\\\\\\"unicode-escape\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\u0041\\\\\\",\\\\\\"backslash-single-quote\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\u0027\\\\\\",\\\\\\"backslash-backslash\\\\\\":\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\"errors\\\\\\":[\\\\\\"ERROR1001\\\\\\",\\\\\\"ERROR1002\\\\\\"],\\\\\\"complex\\\\\\":{\\\\\\"warnings\\\\\\":[\\\\\\"NOTE: This is warning\\\\\\",{\\\\\\"named-waring\\\\\\":\\\\\\"this is {type} warining\\\\\\"}]}}\\") @@ -566,7 +566,7 @@ complex: } `; -exports[`useClassComponent: code 1`] = ` +exports[`useClassComponent > code 1`] = ` "export default function (Component) { const _Component = Component.__o || Component _Component.__i18n = _Component.__i18n || [] @@ -606,10 +606,10 @@ exports[`useClassComponent: code 1`] = ` }" `; -exports[`useClassComponent: map 1`] = ` -Object { +exports[`useClassComponent > map 1`] = ` +{ "mappings": "sEAAGA;;6EAEOC;;qMAECC,aAAAC,8BAAAC,wBAAAC,wBAAAC,2BAAAC;kHACJC,QAAAJ,wBAAAK;yEACDC;gFACOC;yEACPC;2EACEC;kFACOC;0FACQC;uFACHC;;sEAEjBC;sEACAC;;;wEAGEC;gIACcC,YAAAC,8BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "no apples", @@ -634,10 +634,10 @@ Object { "type", " warining", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.yaml", ], - "sourcesContent": Array [ + "sourcesContent": [ "hi: hi there! nested: \\"hello\\": \\"hello world!\\" @@ -664,7 +664,7 @@ complex: } `; -exports[`yaml: code 1`] = ` +exports[`yaml > code 1`] = ` "const resource = { \\"hi\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hi there!\\"])};fn.source=\\"hi there!\\";return fn;})(), \\"nested\\": { @@ -698,10 +698,10 @@ exports[`yaml: code 1`] = ` export default resource" `; -exports[`yaml: map 1`] = ` -Object { +exports[`yaml > map 1`] = ` +{ "mappings": "sEAAGA;;6EAEOC;;qMAECC,aAAAC,8BAAAC,wBAAAC,wBAAAC,2BAAAC;kHACJC,QAAAJ,wBAAAK;yEACDC;gFACOC;yEACPC;2EACEC;kFACOC;0FACQC;uFACHC;;sEAEjBC;sEACAC;;;wEAGEC;gIACcC,YAAAC,8BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "no apples", @@ -726,10 +726,10 @@ Object { "type", " warining", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.yaml", ], - "sourcesContent": Array [ + "sourcesContent": [ "hi: hi there! nested: \\"hello\\": \\"hello world!\\" @@ -756,7 +756,7 @@ complex: } `; -exports[`yml: code 1`] = ` +exports[`yml > code 1`] = ` "const resource = { \\"hi\\": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize([\\"hi there!\\"])};fn.source=\\"hi there!\\";return fn;})(), \\"nested\\": { @@ -790,10 +790,10 @@ exports[`yml: code 1`] = ` export default resource" `; -exports[`yml: map 1`] = ` -Object { +exports[`yml > map 1`] = ` +{ "mappings": "sEAAGA;;6EAEOC;;qMAECC,aAAAC,8BAAAC,wBAAAC,wBAAAC,2BAAAC;kHACJC,QAAAJ,wBAAAK;yEACDC;gFACOC;yEACPC;2EACEC;kFACOC;0FACQC;uFACHC;;sEAEjBC;sEACAC;;;wEAGEC;gIACcC,YAAAC,8BAAAC", - "names": Array [ + "names": [ "hi there!", "hello world!", "no apples", @@ -818,10 +818,10 @@ Object { "type", " warining", ], - "sources": Array [ + "sources": [ "vue-i18n-loader.yaml", ], - "sourcesContent": Array [ + "sourcesContent": [ "hi: hi there! nested: \\"hello\\": \\"hello world!\\" diff --git a/packages/bundle-utils/tsconfig.json b/packages/bundle-utils/tsconfig.json index a5a7ab6..1ff34c1 100644 --- a/packages/bundle-utils/tsconfig.json +++ b/packages/bundle-utils/tsconfig.json @@ -5,7 +5,7 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ "target": "es2019", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..556ad64 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + globals: true + } +}) diff --git a/yarn.lock b/yarn.lock index f76ac41..f6e1a98 100644 --- a/yarn.lock +++ b/yarn.lock @@ -918,7 +918,7 @@ __metadata: "@types/json5": ^2.2.0 "@types/loader-utils": ^2.0.0 "@types/memory-fs": ^0.3.2 - "@types/node": ^15.12.4 + "@types/node": ^18.15.11 "@types/semver": ^7.3.6 "@types/webpack": ^4.41.26 "@types/webpack-merge": ^4.1.5 @@ -959,6 +959,7 @@ __metadata: ts-jest: ^27.0.5 typescript: ^4.9.3 vite: ^2.9.6 + vitest: ^0.29.8 vue: ^2.6.14 vue-i18n: beta vue-loader: ^16.3.0 @@ -987,7 +988,9 @@ __metadata: estree-walker: ^2.0.2 jsonc-eslint-parser: ^1.0.1 magic-string: ^0.30.0 + mlly: ^1.2.0 source-map: 0.6.1 + unbuild: ^1.1.2 yaml-eslint-parser: ^0.3.2 peerDependenciesMeta: petite-vue-i18n: @@ -2238,6 +2241,22 @@ __metadata: languageName: node linkType: hard +"@types/chai-subset@npm:^1.3.3": + version: 1.3.3 + resolution: "@types/chai-subset@npm:1.3.3" + dependencies: + "@types/chai": "*" + checksum: 4481da7345022995f5a105e6683744f7203d2c3d19cfe88d8e17274d045722948abf55e0adfd97709e0f043dade37a4d4e98cd4c660e2e8a14f23e6ecf79418f + languageName: node + linkType: hard + +"@types/chai@npm:*, @types/chai@npm:^4.3.4": + version: 4.3.4 + resolution: "@types/chai@npm:4.3.4" + checksum: 571184967beb03bf64c4392a13a7d44e72da9af5a1e83077ff81c39cf59c0fda2a5c78d2005084601cf8f3d11726608574d8b5b4a0e3e9736792807afd926cd0 + languageName: node + linkType: hard + "@types/debug@npm:^4.1.5": version: 4.1.7 resolution: "@types/debug@npm:4.1.7" @@ -2437,10 +2456,10 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^15.12.4": - version: 15.14.9 - resolution: "@types/node@npm:15.14.9" - checksum: 49f7f0522a3af4b8389aee660e88426490cd54b86356672a1fedb49919a8797c00d090ec2dcc4a5df34edc2099d57fc2203d796c4e7fbd382f2022ccd789eee7 +"@types/node@npm:^18.15.11": + version: 18.15.11 + resolution: "@types/node@npm:18.15.11" + checksum: 977b4ad04708897ff0eb049ecf82246d210939c82461922d20f7d2dcfd81bbc661582ba3af28869210f7e8b1934529dcd46bff7d448551400f9d48b9d3bddec3 languageName: node linkType: hard @@ -2738,6 +2757,49 @@ __metadata: languageName: node linkType: hard +"@vitest/expect@npm:0.29.8": + version: 0.29.8 + resolution: "@vitest/expect@npm:0.29.8" + dependencies: + "@vitest/spy": 0.29.8 + "@vitest/utils": 0.29.8 + chai: ^4.3.7 + checksum: a80f9c352a979eb46690be2ea54b5ca391d3575b4053be80c1359325fb0cea913d6217f48d54e64ff5dda3b15bd7a6873a5f8128e8c098f7ebad1365d4065c5e + languageName: node + linkType: hard + +"@vitest/runner@npm:0.29.8": + version: 0.29.8 + resolution: "@vitest/runner@npm:0.29.8" + dependencies: + "@vitest/utils": 0.29.8 + p-limit: ^4.0.0 + pathe: ^1.1.0 + checksum: 8305370ff6c3fc6aea7189bd138ee4ff0e040a959c0fe6ab64bcb9e70ae5bf836b8dc058b1de288aa75c9d1cd648e5f112e7cd5691c03b7a1d32466d8bfc71a9 + languageName: node + linkType: hard + +"@vitest/spy@npm:0.29.8": + version: 0.29.8 + resolution: "@vitest/spy@npm:0.29.8" + dependencies: + tinyspy: ^1.0.2 + checksum: 7b1607b696275bf94a497e92d7d10c466b9b3d08726bbedb3735bdf57f003763a9516e328af22746829526ce573f87eb6119ab64ce7db95794b2d220aa53b607 + languageName: node + linkType: hard + +"@vitest/utils@npm:0.29.8": + version: 0.29.8 + resolution: "@vitest/utils@npm:0.29.8" + dependencies: + cli-truncate: ^3.1.0 + diff: ^5.1.0 + loupe: ^2.3.6 + pretty-format: ^27.5.1 + checksum: fa18cccb6ab5295e43a1a43b9c022f070646a893adb0561c50b3e0c39f05ea74cbf379aef22ef485ea9acbf2bb8f0a224d457fd4f16b9e1bf509c13052c7f08b + languageName: node + linkType: hard + "@vue/compiler-core@npm:3.2.23": version: 3.2.23 resolution: "@vue/compiler-core@npm:3.2.23" @@ -3429,6 +3491,13 @@ __metadata: languageName: node linkType: hard +"acorn-walk@npm:^8.2.0": + version: 8.2.0 + resolution: "acorn-walk@npm:8.2.0" + checksum: 1715e76c01dd7b2d4ca472f9c58968516a4899378a63ad5b6c2d668bba8da21a71976c14ec5f5b75f887b6317c4ae0b897ab141c831d741dc76024d8745f1ad1 + languageName: node + linkType: hard + "acorn@npm:^6.0.2, acorn@npm:^6.4.1": version: 6.4.2 resolution: "acorn@npm:6.4.2" @@ -3465,7 +3534,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.8.2": +"acorn@npm:^8.8.1, acorn@npm:^8.8.2": version: 8.8.2 resolution: "acorn@npm:8.8.2" bin: @@ -3662,6 +3731,13 @@ __metadata: languageName: node linkType: hard +"ansi-regex@npm:^6.0.1": + version: 6.0.1 + resolution: "ansi-regex@npm:6.0.1" + checksum: 1ff8b7667cded1de4fa2c9ae283e979fc87036864317da86a2e546725f96406746411d0d85e87a2d12fa5abd715d90006de7fa4fa0477c92321ad3b4c7d4e169 + languageName: node + linkType: hard + "ansi-styles@npm:^2.2.1": version: 2.2.1 resolution: "ansi-styles@npm:2.2.1" @@ -3694,6 +3770,13 @@ __metadata: languageName: node linkType: hard +"ansi-styles@npm:^6.0.0": + version: 6.2.1 + resolution: "ansi-styles@npm:6.2.1" + checksum: ef940f2f0ced1a6347398da88a91da7930c33ecac3c77b72c5905f8b8fe402c52e6fde304ff5347f616e27a742da3f1dc76de98f6866c69251ad0b07a66776d9 + languageName: node + linkType: hard + "any-promise@npm:^1.0.0": version: 1.3.0 resolution: "any-promise@npm:1.3.0" @@ -3869,6 +3952,13 @@ __metadata: languageName: node linkType: hard +"assertion-error@npm:^1.1.0": + version: 1.1.0 + resolution: "assertion-error@npm:1.1.0" + checksum: fd9429d3a3d4fd61782eb3962ae76b6d08aa7383123fca0596020013b3ebd6647891a85b05ce821c47d1471ed1271f00b0545cf6a4326cf2fc91efcc3b0fbecf + languageName: node + linkType: hard + "assign-symbols@npm:^1.0.0": version: 1.0.0 resolution: "assign-symbols@npm:1.0.0" @@ -4471,6 +4561,13 @@ __metadata: languageName: node linkType: hard +"cac@npm:^6.7.14": + version: 6.7.14 + resolution: "cac@npm:6.7.14" + checksum: 45a2496a9443abbe7f52a49b22fbe51b1905eff46e03fd5e6c98e3f85077be3f8949685a1849b1a9cd2bc3e5567dfebcf64f01ce01847baf918f1b37c839791a + languageName: node + linkType: hard + "cacache@npm:^12.0.2": version: 12.0.4 resolution: "cacache@npm:12.0.4" @@ -4627,6 +4724,21 @@ __metadata: languageName: node linkType: hard +"chai@npm:^4.3.7": + version: 4.3.7 + resolution: "chai@npm:4.3.7" + dependencies: + assertion-error: ^1.1.0 + check-error: ^1.0.2 + deep-eql: ^4.1.2 + get-func-name: ^2.0.0 + loupe: ^2.3.1 + pathval: ^1.1.1 + type-detect: ^4.0.5 + checksum: 0bba7d267848015246a66995f044ce3f0ebc35e530da3cbdf171db744e14cbe301ab913a8d07caf7952b430257ccbb1a4a983c570a7c5748dc537897e5131f7c + languageName: node + linkType: hard + "chalk@npm:2.4.1": version: 2.4.1 resolution: "chalk@npm:2.4.1" @@ -4686,6 +4798,13 @@ __metadata: languageName: node linkType: hard +"check-error@npm:^1.0.2": + version: 1.0.2 + resolution: "check-error@npm:1.0.2" + checksum: d9d106504404b8addd1ee3f63f8c0eaa7cd962a1a28eb9c519b1c4a1dc7098be38007fc0060f045ee00f075fbb7a2a4f42abcf61d68323677e11ab98dc16042e + languageName: node + linkType: hard + "chokidar@npm:^2.1.8": version: 2.1.8 resolution: "chokidar@npm:2.1.8" @@ -4841,6 +4960,16 @@ __metadata: languageName: node linkType: hard +"cli-truncate@npm:^3.1.0": + version: 3.1.0 + resolution: "cli-truncate@npm:3.1.0" + dependencies: + slice-ansi: ^5.0.0 + string-width: ^5.0.0 + checksum: c3243e41974445691c63f8b405df1d5a24049dc33d324fe448dc572e561a7b772ae982692900b1a5960901cc4fc7def25a629b9c69a4208ee89d12ab3332617a + languageName: node + linkType: hard + "clipboardy@npm:1.2.3": version: 1.2.3 resolution: "clipboardy@npm:1.2.3" @@ -5472,6 +5601,15 @@ __metadata: languageName: node linkType: hard +"deep-eql@npm:^4.1.2": + version: 4.1.3 + resolution: "deep-eql@npm:4.1.3" + dependencies: + type-detect: ^4.0.0 + checksum: 7f6d30cb41c713973dc07eaadded848b2ab0b835e518a88b91bea72f34e08c4c71d167a722a6f302d3a6108f05afd8e6d7650689a84d5d29ec7fe6220420397f + languageName: node + linkType: hard + "deep-equal@npm:^1.0.1": version: 1.1.1 resolution: "deep-equal@npm:1.1.1" @@ -5664,6 +5802,13 @@ __metadata: languageName: node linkType: hard +"diff@npm:^5.1.0": + version: 5.1.0 + resolution: "diff@npm:5.1.0" + checksum: c7bf0df7c9bfbe1cf8a678fd1b2137c4fb11be117a67bc18a0e03ae75105e8533dbfb1cda6b46beb3586ef5aed22143ef9d70713977d5fb1f9114e21455fba90 + languageName: node + linkType: hard + "diffie-hellman@npm:^5.0.0": version: 5.0.3 resolution: "diffie-hellman@npm:5.0.3" @@ -5747,6 +5892,13 @@ __metadata: languageName: node linkType: hard +"eastasianwidth@npm:^0.2.0": + version: 0.2.0 + resolution: "eastasianwidth@npm:0.2.0" + checksum: 7d00d7cd8e49b9afa762a813faac332dee781932d6f2c848dc348939c4253f1d4564341b7af1d041853bc3f32c2ef141b58e0a4d9862c17a7f08f68df1e0f1ed + languageName: node + linkType: hard + "ee-first@npm:1.1.1": version: 1.1.1 resolution: "ee-first@npm:1.1.1" @@ -5804,6 +5956,13 @@ __metadata: languageName: node linkType: hard +"emoji-regex@npm:^9.2.2": + version: 9.2.2 + resolution: "emoji-regex@npm:9.2.2" + checksum: 8487182da74aabd810ac6d6f1994111dfc0e331b01271ae01ec1eb0ad7b5ecc2bbbbd2f053c05cb55a1ac30449527d819bbfbf0e3de1023db308cbcb47f86601 + languageName: node + linkType: hard + "emojis-list@npm:^3.0.0": version: 3.0.0 resolution: "emojis-list@npm:3.0.0" @@ -6214,7 +6373,7 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.17.14, esbuild@npm:^0.17.8": +"esbuild@npm:^0.17.14, esbuild@npm:^0.17.5, esbuild@npm:^0.17.8": version: 0.17.14 resolution: "esbuild@npm:0.17.14" dependencies: @@ -7421,6 +7580,13 @@ __metadata: languageName: node linkType: hard +"get-func-name@npm:^2.0.0": + version: 2.0.0 + resolution: "get-func-name@npm:2.0.0" + checksum: 8d82e69f3e7fab9e27c547945dfe5cc0c57fc0adf08ce135dddb01081d75684a03e7a0487466f478872b341d52ac763ae49e660d01ab83741f74932085f693c3 + languageName: node + linkType: hard + "get-intrinsic@npm:^1.0.2, get-intrinsic@npm:^1.1.0, get-intrinsic@npm:^1.1.1": version: 1.1.1 resolution: "get-intrinsic@npm:1.1.1" @@ -8551,6 +8717,13 @@ __metadata: languageName: node linkType: hard +"is-fullwidth-code-point@npm:^4.0.0": + version: 4.0.0 + resolution: "is-fullwidth-code-point@npm:4.0.0" + checksum: 8ae89bf5057bdf4f57b346fb6c55e9c3dd2549983d54191d722d5c739397a903012cc41a04ee3403fd872e811243ef91a7c5196da7b5841dc6b6aae31a264a8d + languageName: node + linkType: hard + "is-generator-fn@npm:^2.0.0": version: 2.1.0 resolution: "is-generator-fn@npm:2.1.0" @@ -9873,6 +10046,13 @@ __metadata: languageName: node linkType: hard +"local-pkg@npm:^0.4.2": + version: 0.4.3 + resolution: "local-pkg@npm:0.4.3" + checksum: 7825aca531dd6afa3a3712a0208697aa4a5cd009065f32e3fb732aafcc42ed11f277b5ac67229222e96f4def55197171cdf3d5522d0381b489d2e5547b407d55 + languageName: node + linkType: hard + "locate-path@npm:^3.0.0": version: 3.0.0 resolution: "locate-path@npm:3.0.0" @@ -9969,6 +10149,15 @@ __metadata: languageName: node linkType: hard +"loupe@npm:^2.3.1, loupe@npm:^2.3.6": + version: 2.3.6 + resolution: "loupe@npm:2.3.6" + dependencies: + get-func-name: ^2.0.0 + checksum: cc83f1b124a1df7384601d72d8d1f5fe95fd7a8185469fec48bb2e4027e45243949e7a013e8d91051a138451ff0552310c32aa9786e60b6a30d1e801bdc2163f + languageName: node + linkType: hard + "lru-cache@npm:^4.0.1, lru-cache@npm:^4.1.2": version: 4.1.5 resolution: "lru-cache@npm:4.1.5" @@ -10600,7 +10789,7 @@ __metadata: languageName: node linkType: hard -"mlly@npm:^1.1.1, mlly@npm:^1.2.0": +"mlly@npm:^1.1.0, mlly@npm:^1.1.1, mlly@npm:^1.2.0": version: 1.2.0 resolution: "mlly@npm:1.2.0" dependencies: @@ -11186,6 +11375,15 @@ __metadata: languageName: node linkType: hard +"p-limit@npm:^4.0.0": + version: 4.0.0 + resolution: "p-limit@npm:4.0.0" + dependencies: + yocto-queue: ^1.0.0 + checksum: 01d9d70695187788f984226e16c903475ec6a947ee7b21948d6f597bed788e3112cc7ec2e171c1d37125057a5f45f3da21d8653e04a3a793589e12e9e80e756b + languageName: node + linkType: hard + "p-locate@npm:^3.0.0": version: 3.0.0 resolution: "p-locate@npm:3.0.0" @@ -11467,6 +11665,13 @@ __metadata: languageName: node linkType: hard +"pathval@npm:^1.1.1": + version: 1.1.1 + resolution: "pathval@npm:1.1.1" + checksum: 090e3147716647fb7fb5b4b8c8e5b55e5d0a6086d085b6cd23f3d3c01fcf0ff56fd3cc22f2f4a033bd2e46ed55d61ed8379e123b42afe7d531a2a5fc8bb556d6 + languageName: node + linkType: hard + "pbkdf2@npm:^3.0.3": version: 3.1.2 resolution: "pbkdf2@npm:3.1.2" @@ -11673,6 +11878,17 @@ __metadata: languageName: node linkType: hard +"postcss@npm:^8.4.21": + version: 8.4.21 + resolution: "postcss@npm:8.4.21" + dependencies: + nanoid: ^3.3.4 + picocolors: ^1.0.0 + source-map-js: ^1.0.2 + checksum: e39ac60ccd1542d4f9d93d894048aac0d686b3bb38e927d8386005718e6793dbbb46930f0a523fe382f1bbd843c6d980aaea791252bf5e176180e5a4336d9679 + languageName: node + linkType: hard + "prelude-ls@npm:^1.2.1": version: 1.2.1 resolution: "prelude-ls@npm:1.2.1" @@ -12504,7 +12720,7 @@ __metadata: languageName: node linkType: hard -"rollup@npm:^3.15.0": +"rollup@npm:^3.15.0, rollup@npm:^3.18.0": version: 3.20.2 resolution: "rollup@npm:3.20.2" dependencies: @@ -12920,6 +13136,13 @@ __metadata: languageName: node linkType: hard +"siginfo@npm:^2.0.0": + version: 2.0.0 + resolution: "siginfo@npm:2.0.0" + checksum: 8aa5a98640ca09fe00d74416eca97551b3e42991614a3d1b824b115fc1401543650914f651ab1311518177e4d297e80b953f4cd4cd7ea1eabe824e8f2091de01 + languageName: node + linkType: hard + "signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3, signal-exit@npm:^3.0.6, signal-exit@npm:^3.0.7": version: 3.0.7 resolution: "signal-exit@npm:3.0.7" @@ -12977,6 +13200,16 @@ __metadata: languageName: node linkType: hard +"slice-ansi@npm:^5.0.0": + version: 5.0.0 + resolution: "slice-ansi@npm:5.0.0" + dependencies: + ansi-styles: ^6.0.0 + is-fullwidth-code-point: ^4.0.0 + checksum: 7e600a2a55e333a21ef5214b987c8358fe28bfb03c2867ff2cbf919d62143d1812ac27b4297a077fdaf27a03da3678e49551c93e35f9498a3d90221908a1180e + languageName: node + linkType: hard + "smart-buffer@npm:^4.1.0, smart-buffer@npm:^4.2.0": version: 4.2.0 resolution: "smart-buffer@npm:4.2.0" @@ -13291,6 +13524,13 @@ __metadata: languageName: node linkType: hard +"stackback@npm:0.0.2": + version: 0.0.2 + resolution: "stackback@npm:0.0.2" + checksum: 2d4dc4e64e2db796de4a3c856d5943daccdfa3dd092e452a1ce059c81e9a9c29e0b9badba91b43ef0d5ff5c04ee62feb3bcc559a804e16faf447bac2d883aa99 + languageName: node + linkType: hard + "static-extend@npm:^0.1.1": version: 0.1.2 resolution: "static-extend@npm:0.1.2" @@ -13315,6 +13555,13 @@ __metadata: languageName: node linkType: hard +"std-env@npm:^3.3.1": + version: 3.3.2 + resolution: "std-env@npm:3.3.2" + checksum: c02256bb041ba1870d23f8360bc7e47a9cf1fabcd02c8b7c4246d48f2c6bb47b4f45c70964348844e6d36521df84c4a9d09d468654b51e0eb5c600e3392b4570 + languageName: node + linkType: hard + "stream-browserify@npm:^2.0.1": version: 2.0.2 resolution: "stream-browserify@npm:2.0.2" @@ -13415,6 +13662,17 @@ __metadata: languageName: node linkType: hard +"string-width@npm:^5.0.0": + version: 5.1.2 + resolution: "string-width@npm:5.1.2" + dependencies: + eastasianwidth: ^0.2.0 + emoji-regex: ^9.2.2 + strip-ansi: ^7.0.1 + checksum: 7369deaa29f21dda9a438686154b62c2c5f661f8dda60449088f9f980196f7908fc39fdd1803e3e01541970287cf5deae336798337e9319a7055af89dafa7193 + languageName: node + linkType: hard + "string.prototype.padend@npm:^3.0.0": version: 3.1.3 resolution: "string.prototype.padend@npm:3.1.3" @@ -13513,6 +13771,15 @@ __metadata: languageName: node linkType: hard +"strip-ansi@npm:^7.0.1": + version: 7.0.1 + resolution: "strip-ansi@npm:7.0.1" + dependencies: + ansi-regex: ^6.0.1 + checksum: 257f78fa433520e7f9897722731d78599cb3fce29ff26a20a5e12ba4957463b50a01136f37c43707f4951817a75e90820174853d6ccc240997adc5df8f966039 + languageName: node + linkType: hard + "strip-bom@npm:^3.0.0": version: 3.0.0 resolution: "strip-bom@npm:3.0.0" @@ -13571,6 +13838,15 @@ __metadata: languageName: node linkType: hard +"strip-literal@npm:^1.0.0": + version: 1.0.1 + resolution: "strip-literal@npm:1.0.1" + dependencies: + acorn: ^8.8.2 + checksum: ab40496820f02220390d95cdd620a997168efb69d5bd7d180bc4ef83ca562a95447843d8c7c88b8284879a29cf4eedc89d8001d1e098c1a1e23d12a9c755dff4 + languageName: node + linkType: hard + "structured-source@npm:^3.0.2": version: 3.0.2 resolution: "structured-source@npm:3.0.2" @@ -13907,6 +14183,27 @@ __metadata: languageName: node linkType: hard +"tinybench@npm:^2.3.1": + version: 2.4.0 + resolution: "tinybench@npm:2.4.0" + checksum: cfbe90f75755488653dde256019cc810f65e90f63fdd962e71e8b209b49598c5fc90c2227d2087eb807944895fafe7f12fe9ecae2b5e89db5adde66415e9b836 + languageName: node + linkType: hard + +"tinypool@npm:^0.4.0": + version: 0.4.0 + resolution: "tinypool@npm:0.4.0" + checksum: 8abcac9e784793499f1eeeace8290c026454b9d7338c74029ce6a821643bab8dcab7caeb4051e39006baf681d6a62d57c3319e9c0f6e2317a45ab0fdbd76ee26 + languageName: node + linkType: hard + +"tinyspy@npm:^1.0.2": + version: 1.1.1 + resolution: "tinyspy@npm:1.1.1" + checksum: 4ea908fdfddb92044c4454193ec543f5980ced0bd25c5b3d240a94c1511e47e765ad39cd13ae6d3370fb730f62038eedc357f55e4e239416e126bc418f0eee79 + languageName: node + linkType: hard + "tmpl@npm:1.0.5": version: 1.0.5 resolution: "tmpl@npm:1.0.5" @@ -14117,7 +14414,7 @@ __metadata: languageName: node linkType: hard -"type-detect@npm:4.0.8": +"type-detect@npm:4.0.8, type-detect@npm:^4.0.0, type-detect@npm:^4.0.5": version: 4.0.8 resolution: "type-detect@npm:4.0.8" checksum: 62b5628bff67c0eb0b66afa371bd73e230399a8d2ad30d852716efcc4656a7516904570cd8631a49a3ce57c10225adf5d0cbdcb47f6b0255fe6557c453925a15 @@ -14545,6 +14842,22 @@ __metadata: languageName: node linkType: hard +"vite-node@npm:0.29.8": + version: 0.29.8 + resolution: "vite-node@npm:0.29.8" + dependencies: + cac: ^6.7.14 + debug: ^4.3.4 + mlly: ^1.1.0 + pathe: ^1.1.0 + picocolors: ^1.0.0 + vite: ^3.0.0 || ^4.0.0 + bin: + vite-node: vite-node.mjs + checksum: b0981d4d63b1f373579eb9da69ca5af9123bf27c81ac246c541cdecf879ef4ef542e0b521cb6ceaafd5ead2cc3d243105d1fb8bf076953d42a6b2203607ce928 + languageName: node + linkType: hard + "vite@npm:^2.9.6": version: 2.9.15 resolution: "vite@npm:2.9.15" @@ -14574,6 +14887,104 @@ __metadata: languageName: node linkType: hard +"vite@npm:^3.0.0 || ^4.0.0": + version: 4.2.1 + resolution: "vite@npm:4.2.1" + dependencies: + esbuild: ^0.17.5 + fsevents: ~2.3.2 + postcss: ^8.4.21 + resolve: ^1.22.1 + rollup: ^3.18.0 + peerDependencies: + "@types/node": ">= 14" + less: "*" + sass: "*" + stylus: "*" + sugarss: "*" + terser: ^5.4.0 + dependenciesMeta: + fsevents: + optional: true + peerDependenciesMeta: + "@types/node": + optional: true + less: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + bin: + vite: bin/vite.js + checksum: 70eb162ffc299017a3c310e3adc95e9661def6b17aafd1f8e5e02e516766060435590dbe3df1e4e95acc3583c728a76e91f07c546221d1e701f1b2b021293f45 + languageName: node + linkType: hard + +"vitest@npm:^0.29.8": + version: 0.29.8 + resolution: "vitest@npm:0.29.8" + dependencies: + "@types/chai": ^4.3.4 + "@types/chai-subset": ^1.3.3 + "@types/node": "*" + "@vitest/expect": 0.29.8 + "@vitest/runner": 0.29.8 + "@vitest/spy": 0.29.8 + "@vitest/utils": 0.29.8 + acorn: ^8.8.1 + acorn-walk: ^8.2.0 + cac: ^6.7.14 + chai: ^4.3.7 + debug: ^4.3.4 + local-pkg: ^0.4.2 + pathe: ^1.1.0 + picocolors: ^1.0.0 + source-map: ^0.6.1 + std-env: ^3.3.1 + strip-literal: ^1.0.0 + tinybench: ^2.3.1 + tinypool: ^0.4.0 + tinyspy: ^1.0.2 + vite: ^3.0.0 || ^4.0.0 + vite-node: 0.29.8 + why-is-node-running: ^2.2.2 + peerDependencies: + "@edge-runtime/vm": "*" + "@vitest/browser": "*" + "@vitest/ui": "*" + happy-dom: "*" + jsdom: "*" + playwright: "*" + safaridriver: "*" + webdriverio: "*" + peerDependenciesMeta: + "@edge-runtime/vm": + optional: true + "@vitest/browser": + optional: true + "@vitest/ui": + optional: true + happy-dom: + optional: true + jsdom: + optional: true + playwright: + optional: true + safaridriver: + optional: true + webdriverio: + optional: true + bin: + vitest: vitest.mjs + checksum: 203e33bf093fdb99a6832c905a6c78175bb15313e06e1dcfbeb010a0e3efb8ff0aba4d317efedb4de76bd0086691bbd2c4bc7d6631f60fb1634b96832cba144f + languageName: node + linkType: hard + "vm-browserify@npm:^1.0.1": version: 1.1.2 resolution: "vm-browserify@npm:1.1.2" @@ -15156,6 +15567,18 @@ __metadata: languageName: node linkType: hard +"why-is-node-running@npm:^2.2.2": + version: 2.2.2 + resolution: "why-is-node-running@npm:2.2.2" + dependencies: + siginfo: ^2.0.0 + stackback: 0.0.2 + bin: + why-is-node-running: cli.js + checksum: 50820428f6a82dfc3cbce661570bcae9b658723217359b6037b67e495255409b4c8bc7931745f5c175df71210450464517cab32b2f7458ac9c40b4925065200a + languageName: node + linkType: hard + "wide-align@npm:^1.1.5": version: 1.1.5 resolution: "wide-align@npm:1.1.5" @@ -15451,6 +15874,13 @@ __metadata: languageName: node linkType: hard +"yocto-queue@npm:^1.0.0": + version: 1.0.0 + resolution: "yocto-queue@npm:1.0.0" + checksum: 2cac84540f65c64ccc1683c267edce396b26b1e931aa429660aefac8fbe0188167b7aee815a3c22fa59a28a58d898d1a2b1825048f834d8d629f4c2a5d443801 + languageName: node + linkType: hard + "yorkie@npm:^2.0.0": version: 2.0.0 resolution: "yorkie@npm:2.0.0"