2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-05-15 11:59:37 +03:00

fix: proper module resolution in all cases (Node CJS, Node ESM, bundler)

* Add extensions to all imports

* Set module resolution to `bundler` to avoid Node specific behavior

* Use `ts2mjs` to rename files to `mjs`

* Add extensions to `@bbob/types` imports

* Fix `package.json` for proper ESM extension and type separation

* More module resolution stuff change (`node16` for everything, `node` for Vue 2 plugin)

* Use `ts-jest-resolver` for `js` -> `ts` resolving in Jest

* Add changeset

* Add import extensions to frontend libs
This commit is contained in:
Long Nguyen
2025-08-19 00:13:22 +07:00
committed by GitHub
parent 8126feb834
commit 0edd490a24
39 changed files with 287 additions and 124 deletions
+21
View File
@@ -0,0 +1,21 @@
---
"@bbob/cli": patch
"@bbob/core": patch
"@bbob/html": patch
"@bbob/parser": patch
"@bbob/plugin-helper": patch
"@bbob/preset-html5": patch
"@bbob/preset-react": patch
"@bbob/preset-vue": patch
"@bbob/preset": patch
"@bbob/react": patch
"@bbob/types": patch
"@bbob/vue2": patch
"@bbob/vue3": patch
---
fix: proper module resolution in all cases (Node CJS, Node ESM, bundler)
Allow usages of this library in ESM scenarios (Vite SSR, pure Node using ESM) by fixing incorrect exports of the ESM output (use correct .mjs extension, separate types files for CJS and ESM output, package.json fixes)
Fixes #232, #214, #135
+1
View File
@@ -7,6 +7,7 @@ module.exports = {
setupFilesAfterEnv: [`${__dirname}/jest.setup.js`], setupFilesAfterEnv: [`${__dirname}/jest.setup.js`],
coverageDirectory: './coverage/', coverageDirectory: './coverage/',
collectCoverage: true, collectCoverage: true,
resolver: "ts-jest-resolver",
transform: { transform: {
'\\.[jt]sx?$': ['@swc/jest', { ...config }], '\\.[jt]sx?$': ['@swc/jest', { ...config }],
}, },
+4 -2
View File
@@ -66,6 +66,8 @@
"rollup-plugin-gzip": "3.1.0", "rollup-plugin-gzip": "3.1.0",
"rollup-plugin-swc3": "0.11.0", "rollup-plugin-swc3": "0.11.0",
"size-limit": "11.0.1", "size-limit": "11.0.1",
"ts-jest-resolver": "^2.0.1",
"ts2mjs": "^4.0.0",
"typescript": "5.1.6" "typescript": "5.1.6"
}, },
"publishConfig": { "publishConfig": {
@@ -80,13 +82,13 @@
}, },
"pkgTasks": { "pkgTasks": {
"build:commonjs": "@/cross-env BABEL_ENV=commonjs NODE_ENV=production @/swc ./src/ --config-file ../../.swcrc-commonjs.json --out-dir lib --strip-leading-paths", "build:commonjs": "@/cross-env BABEL_ENV=commonjs NODE_ENV=production @/swc ./src/ --config-file ../../.swcrc-commonjs.json --out-dir lib --strip-leading-paths",
"build:es": "@/cross-env BABEL_ENV=es NODE_ENV=production @/swc ./src/ --config-file ../../.swcrc.json --out-dir es --strip-leading-paths", "build:es": "@/cross-env BABEL_ENV=es NODE_ENV=production @/swc ./src/ --config-file ../../.swcrc.json --out-dir es --strip-leading-paths && @/ts2mjs es --remove-source",
"build:umd": "@/cross-env BABEL_ENV=rollup NODE_ENV=production @/rollup --config ../../rollup.config.mjs", "build:umd": "@/cross-env BABEL_ENV=rollup NODE_ENV=production @/rollup --config ../../rollup.config.mjs",
"build": "npm run build:es && npm run build:commonjs && npm run build:umd", "build": "npm run build:es && npm run build:commonjs && npm run build:umd",
"test": "@/jest", "test": "@/jest",
"cover": "@/jest --coverage .", "cover": "@/jest --coverage .",
"lint": "@/eslint .", "lint": "@/eslint .",
"types": "@/tsc", "types": "@/tsc && @/ts2mjs types",
"bundlesize": "npm run build && @/cross-env NODE_ENV=production @/bundlesize .", "bundlesize": "npm run build && @/cross-env NODE_ENV=production @/bundlesize .",
"size": "npm run build && @/cross-env NODE_ENV=production @/size-limit ." "size": "npm run build && @/cross-env NODE_ENV=production @/size-limit ."
}, },
+10 -5
View File
@@ -6,16 +6,21 @@
"bbob": "lib/cli.js" "bbob": "lib/cli.js"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobCli", "browserName": "BbobCli",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env node #!/usr/bin/env node
import { run } from './index'; import { run } from './index.js';
run(process.stdin, process.stdout); run(process.stdin, process.stdout);
+10 -5
View File
@@ -25,16 +25,21 @@
"@bbob/types": "*" "@bbob/types": "*"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobCore", "browserName": "BbobCore",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+2 -2
View File
@@ -9,8 +9,8 @@ import type {
} from "@bbob/types"; } from "@bbob/types";
import { parse } from '@bbob/parser'; import { parse } from '@bbob/parser';
import { iterate, match } from './utils'; import { iterate, match } from './utils.js';
import { C1, C2 } from './errors' import { C1, C2 } from './errors.js'
export function createTree<Options extends BBobCoreOptions = BBobCoreOptions>(tree: NodeContent[], options: Options) { export function createTree<Options extends BBobCoreOptions = BBobCoreOptions>(tree: NodeContent[], options: Options) {
const extendedTree = tree as BBobCoreTagNodeTree const extendedTree = tree as BBobCoreTagNodeTree
+10 -5
View File
@@ -14,16 +14,21 @@
"@bbob/types": "*" "@bbob/types": "*"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobHtml", "browserName": "BbobHtml",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+42 -17
View File
@@ -24,44 +24,69 @@
"@bbob/types": "*" "@bbob/types": "*"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobParser", "browserName": "BbobParser",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
}, },
"./lexer": { "./lexer": {
"types": "./types/lexer.d.ts", "import": {
"import": "./es/lexer.js", "types": "./types/lexer.d.mts",
"require": "./lib/lexer.js", "default": "./es/lexer.mjs"
},
"require": {
"types": "./types/lexer.d.ts",
"default": "./lib/lexer.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
}, },
"./parse": { "./parse": {
"types": "./types/parse.d.ts", "import": {
"import": "./es/parse.js", "types": "./types/parse.d.mts",
"require": "./lib/parse.js", "default": "./es/parse.mjs"
},
"require": {
"types": "./types/parse.d.ts",
"default": "./lib/parse.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
}, },
"./Token": { "./Token": {
"types": "./types/Token.d.ts", "import": {
"import": "./es/Token.js", "types": "./types/Token.d.mts",
"require": "./lib/Token.js", "default": "./es/Token.mjs"
},
"require": {
"types": "./types/Token.d.ts",
"default": "./lib/Token.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
}, },
"./utils": { "./utils": {
"types": "./types/utils.d.ts", "import": {
"import": "./es/utils.js", "types": "./types/utils.d.mts",
"require": "./lib/utils.js", "default": "./es/utils.mjs"
},
"require": {
"types": "./types/utils.d.ts",
"default": "./lib/utils.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+3 -3
View File
@@ -1,4 +1,4 @@
export { TagNode } from '@bbob/plugin-helper'; export { TagNode } from '@bbob/plugin-helper';
export { default } from './parse'; export { default } from './parse.js';
export * from './parse'; export * from './parse.js';
export * from './lexer' export * from './lexer.js'
+2 -2
View File
@@ -14,8 +14,8 @@ import type { LexerOptions, LexerTokenizer } from "@bbob/types";
import { import {
Token, TYPE_ATTR_NAME, TYPE_ATTR_VALUE, TYPE_NEW_LINE, TYPE_SPACE, TYPE_TAG, TYPE_WORD, Token, TYPE_ATTR_NAME, TYPE_ATTR_VALUE, TYPE_NEW_LINE, TYPE_SPACE, TYPE_TAG, TYPE_WORD,
} from './Token'; } from './Token.js';
import { CharGrabber, createCharGrabber, trimChar, unquote } from './utils'; import { CharGrabber, createCharGrabber, trimChar, unquote } from './utils.js';
// for cases <!-- --> // for cases <!-- -->
const EM = '!'; const EM = '!';
+2 -2
View File
@@ -7,9 +7,9 @@ import {
isTagNode, isTagNode,
} from "@bbob/plugin-helper"; } from "@bbob/plugin-helper";
import { createLexer } from "./lexer"; import { createLexer } from "./lexer.js";
import type { Token } from "./Token"; import type { Token } from "./Token.js";
class NodeList<Value> { class NodeList<Value> {
private n: Value[]; private n: Value[];
+34 -14
View File
@@ -15,8 +15,8 @@
"types" "types"
], ],
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobPluginHelper", "browserName": "BbobPluginHelper",
"types": "types/index.d.ts", "types": "types/index.d.ts",
@@ -25,30 +25,50 @@
}, },
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
}, },
"./char": { "./char": {
"types": "./types/char.d.ts", "import": {
"import": "./es/char.js", "types": "./types/char.d.mts",
"require": "./lib/char.js", "default": "./es/char.mjs"
},
"require": {
"types": "./types/char.d.ts",
"default": "./lib/char.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
}, },
"./helpers": { "./helpers": {
"types": "./types/helpers.d.ts", "import": {
"import": "./es/helpers.js", "types": "./types/helpers.d.mts",
"require": "./lib/helpers.js", "default": "./es/helpers.mjs"
},
"require": {
"types": "./types/helpers.d.ts",
"default": "./lib/helpers.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
}, },
"./TagNode": { "./TagNode": {
"types": "./types/TagNode.d.ts", "import": {
"import": "./es/TagNode.js", "types": "./types/TagNode.d.mts",
"require": "./lib/TagNode.js", "default": "./es/TagNode.mjs"
},
"require": {
"types": "./types/TagNode.d.ts",
"default": "./lib/TagNode.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+2 -2
View File
@@ -1,6 +1,6 @@
import type { NodeContent, TagNodeObject, TagNodeTree, TagPosition } from "@bbob/types"; import type { NodeContent, TagNodeObject, TagNodeTree, TagPosition } from "@bbob/types";
import { OPEN_BRAKET, CLOSE_BRAKET, SLASH } from './char'; import { OPEN_BRAKET, CLOSE_BRAKET, SLASH } from './char.js';
import { import {
getUniqAttr, getUniqAttr,
getNodeLength, getNodeLength,
@@ -8,7 +8,7 @@ import {
attrsToString, attrsToString,
attrValue, attrValue,
isTagNode, isTagNode,
} from './helpers'; } from './helpers.js';
const getTagAttrs = <AttrValue>(tag: string, params: Record<string, AttrValue>) => { const getTagAttrs = <AttrValue>(tag: string, params: Record<string, AttrValue>) => {
const uniqAttr = getUniqAttr(params); const uniqAttr = getUniqAttr(params);
+2 -2
View File
@@ -1,7 +1,7 @@
import type { NodeContent, StringNode } from "@bbob/types"; import type { NodeContent, StringNode } from "@bbob/types";
import { N } from './char'; import { N } from './char.js';
import type { TagNode } from "./TagNode"; import type { TagNode } from "./TagNode.js";
function isTagNode(el: unknown): el is TagNode { function isTagNode(el: unknown): el is TagNode {
return typeof el === 'object' && el !== null && 'tag' in el; return typeof el === 'object' && el !== null && 'tag' in el;
+3 -3
View File
@@ -1,3 +1,3 @@
export * from "./helpers"; export * from "./helpers.js";
export * from "./char"; export * from "./char.js";
export * from "./TagNode"; export * from "./TagNode.js";
+10 -5
View File
@@ -17,16 +17,21 @@
"@bbob/html": "*" "@bbob/html": "*"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobPresetHTML5", "browserName": "BbobPresetHTML5",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+1 -1
View File
@@ -1,6 +1,6 @@
/* eslint-disable indent */ /* eslint-disable indent */
import { createPreset } from "@bbob/preset"; import { createPreset } from "@bbob/preset";
import defaultTags from "./defaultTags"; import defaultTags from "./defaultTags.js";
export type * from "@bbob/preset"; export type * from "@bbob/preset";
export default createPreset(defaultTags); export default createPreset(defaultTags);
+10 -5
View File
@@ -20,16 +20,21 @@
"@types/react": "18.x" "@types/react": "18.x"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobPresetReact", "browserName": "BbobPresetReact",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+10 -5
View File
@@ -12,16 +12,21 @@
"@bbob/types": "*" "@bbob/types": "*"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobPresetVue", "browserName": "BbobPresetVue",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+10 -5
View File
@@ -22,16 +22,21 @@
"@bbob/core": "*" "@bbob/core": "*"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobPreset", "browserName": "BbobPreset",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+2 -2
View File
@@ -1,2 +1,2 @@
export { default } from "./preset"; export { default } from "./preset.js";
export * from "./preset"; export * from "./preset.js";
+10 -5
View File
@@ -26,16 +26,21 @@
"@types/react": "18.x" "@types/react": "18.x"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobReact", "browserName": "BbobReact",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+1 -1
View File
@@ -1,7 +1,7 @@
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import type { BBobPlugins, BBobCoreOptions } from '@bbob/types'; import type { BBobPlugins, BBobCoreOptions } from '@bbob/types';
import { render } from './render'; import { render } from './render.js';
const content = (children: ReactNode, plugins?: BBobPlugins, options?: BBobCoreOptions) => const content = (children: ReactNode, plugins?: BBobPlugins, options?: BBobCoreOptions) =>
React.Children.map(children, React.Children.map(children,
+2 -2
View File
@@ -1,2 +1,2 @@
export { default } from './Component'; export { default } from './Component.js';
export { render } from './render'; export { render } from './render.js';
+11 -1
View File
@@ -14,7 +14,17 @@
"types" "types"
], ],
"types": "types/index.d.ts", "types": "types/index.d.ts",
"module": "types/index.d.ts", "module": "types/index.d.mts",
"exports": {
".": {
"import": {
"types": "./types/index.d.mts"
},
"require": {
"types": "./types/index.d.ts"
}
}
},
"homepage": "https://github.com/JiLiZART/bbob", "homepage": "https://github.com/JiLiZART/bbob",
"author": "Nikolay Kostyurin <jilizart@gmail.com>", "author": "Nikolay Kostyurin <jilizart@gmail.com>",
"license": "MIT", "license": "MIT",
+2 -2
View File
@@ -1,5 +1,5 @@
import { ParseOptions } from "./parser"; import { ParseOptions } from "./parser.js";
import { NodeContent, PartialNodeContent, TagNodeObject, TagNodeTree } from "./common"; import { NodeContent, PartialNodeContent, TagNodeObject, TagNodeTree } from "./common.js";
export interface BBobCoreOptions< export interface BBobCoreOptions<
Data = unknown | null, Data = unknown | null,
+4 -4
View File
@@ -1,4 +1,4 @@
export * from './common' export * from './common.js'
export * from './parser' export * from './parser.js'
export * from './core' export * from './core.js'
export * from './preset' export * from './preset.js'
+1 -1
View File
@@ -1,4 +1,4 @@
import { TagNodeTree, TagPosition } from "./common"; import { TagNodeTree, TagPosition } from "./common.js";
export interface ParseError { export interface ParseError {
tagName: string; tagName: string;
+2 -2
View File
@@ -1,6 +1,6 @@
import { BBobCoreTagNodeTree, BBobPluginFunction, BBobPluginOptions } from "./core"; import { BBobCoreTagNodeTree, BBobPluginFunction, BBobPluginOptions } from "./core.js";
import { TagNodeObject } from "./common"; import { TagNodeObject } from "./common.js";
export type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>> export type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>
+10 -5
View File
@@ -25,16 +25,21 @@
"vue-template-compiler": "2.7.16" "vue-template-compiler": "2.7.16"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobVue", "browserName": "BbobVue",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+1 -1
View File
@@ -1,7 +1,7 @@
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import type { BBobCoreOptions, BBobPlugins } from '@bbob/types'; import type { BBobCoreOptions, BBobPlugins } from '@bbob/types';
import { render } from './render'; import { render } from './render.js';
export type BBobVueComponentProps = { export type BBobVueComponentProps = {
container: string container: string
+2 -2
View File
@@ -1,5 +1,5 @@
import type { VueConstructor } from 'vue'; import type { VueConstructor } from 'vue';
import Component from './Component'; import Component from './Component.js';
function install(vue: VueConstructor) { function install(vue: VueConstructor) {
vue.component("bbob-bbcode", Component); vue.component("bbob-bbcode", Component);
@@ -7,6 +7,6 @@ function install(vue: VueConstructor) {
vue.component("BBCode", Component); vue.component("BBCode", Component);
} }
export { render } from './render'; export { render } from './render.js';
export { Component }; export { Component };
export default install; export default install;
+2 -1
View File
@@ -2,7 +2,8 @@
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": ".",
"outDir": "./types" "outDir": "./types",
"moduleResolution": "node"
}, },
"include": [ "include": [
"./src/**/*" "./src/**/*"
+10 -5
View File
@@ -29,16 +29,21 @@
"vue": "*" "vue": "*"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.mjs",
"jsnext:main": "es/index.js", "jsnext:main": "es/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
"browserName": "BbobVue3", "browserName": "BbobVue3",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./types/index.d.ts", "import": {
"import": "./es/index.js", "types": "./types/index.d.mts",
"require": "./lib/index.js", "default": "./es/index.mjs"
},
"require": {
"types": "./types/index.d.ts",
"default": "./lib/index.js"
},
"browser": "./dist/index.min.js", "browser": "./dist/index.min.js",
"umd": "./dist/index.min.js" "umd": "./dist/index.min.js"
} }
+1 -1
View File
@@ -1,5 +1,5 @@
import { defineComponent, h, VNode } from "vue"; import { defineComponent, h, VNode } from "vue";
import { render } from "./render"; import { render } from "./render.js";
import type { BBobPlugins, BBobCoreOptions } from "@bbob/types"; import type { BBobPlugins, BBobCoreOptions } from "@bbob/types";
+1 -1
View File
@@ -1,5 +1,5 @@
import type { Plugin } from "@vue/runtime-core"; import type { Plugin } from "@vue/runtime-core";
import Component from "./Component"; import Component from "./Component.js";
const plugin = { const plugin = {
install(app) { install(app) {
+33
View File
@@ -149,6 +149,12 @@ importers:
size-limit: size-limit:
specifier: 11.0.1 specifier: 11.0.1
version: 11.0.1 version: 11.0.1
ts-jest-resolver:
specifier: ^2.0.1
version: 2.0.1
ts2mjs:
specifier: ^4.0.0
version: 4.0.0
typescript: typescript:
specifier: 5.1.6 specifier: 5.1.6
version: 5.1.6 version: 5.1.6
@@ -7517,6 +7523,11 @@ packages:
supports-color: 7.2.0 supports-color: 7.2.0
dev: true dev: true
/chalk@5.5.0:
resolution: {integrity: sha512-1tm8DTaJhPBG3bIkVeZt1iZM9GfSX2lzOeDVZH9R9ffRHpmHvxZ/QhgQH/aDTkswQVt+YHdXAdS/In/30OjCbg==}
engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
dev: true
/char-regex@1.0.2: /char-regex@1.0.2:
resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==}
engines: {node: '>=10'} engines: {node: '>=10'}
@@ -7769,6 +7780,11 @@ packages:
engines: {node: '>=14'} engines: {node: '>=14'}
dev: true dev: true
/commander@14.0.0:
resolution: {integrity: sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA==}
engines: {node: '>=20'}
dev: true
/commander@2.20.3: /commander@2.20.3:
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
dev: true dev: true
@@ -16730,6 +16746,12 @@ packages:
typescript: 5.8.2 typescript: 5.8.2
dev: true dev: true
/ts-jest-resolver@2.0.1:
resolution: {integrity: sha512-FolE73BqVZCs8/RbLKxC67iaAtKpBWx7PeLKFW2zJQlOf9j851I7JRxSDenri2NFvVH3QP7v3S8q1AmL24Zb9Q==}
dependencies:
jest-resolve: 29.7.0
dev: true
/ts-node@10.9.1(@swc/core@1.3.107)(@types/node@20.4.5)(typescript@5.1.6): /ts-node@10.9.1(@swc/core@1.3.107)(@types/node@20.4.5)(typescript@5.1.6):
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true hasBin: true
@@ -16810,6 +16832,17 @@ packages:
yn: 3.1.1 yn: 3.1.1
dev: true dev: true
/ts2mjs@4.0.0:
resolution: {integrity: sha512-k+mn9y/2kYNqV7dV9dP2NKw0VY6HfESPqEBwjop0M2AyE6rKd2N/y3DKLtWb0bRjJgFr8uoK8H1Tlr2CKe0oyw==}
engines: {node: '>=20.18.0'}
hasBin: true
dependencies:
chalk: 5.5.0
commander: 14.0.0
globby: 14.1.0
magic-string: 0.30.17
dev: true
/tsconfig-paths@3.15.0: /tsconfig-paths@3.15.0:
resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==}
dependencies: dependencies:
+2 -2
View File
@@ -15,8 +15,8 @@
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"emitDeclarationOnly": true, "emitDeclarationOnly": true,
"esModuleInterop": true, "esModuleInterop": true,
"module": "esnext", "module": "node16",
"moduleResolution": "node", "moduleResolution": "node16",
"resolveJsonModule": true, "resolveJsonModule": true,
"downlevelIteration": true, "downlevelIteration": true,
"jsx": "preserve", "jsx": "preserve",