mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-20 20:00:33 +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:
@@ -15,8 +15,8 @@
|
||||
"types"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
"jsnext:main": "es/index.js",
|
||||
"module": "es/index.mjs",
|
||||
"jsnext:main": "es/index.mjs",
|
||||
"browser": "dist/index.js",
|
||||
"browserName": "BbobPluginHelper",
|
||||
"types": "types/index.d.ts",
|
||||
@@ -25,30 +25,50 @@
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./types/index.d.ts",
|
||||
"import": "./es/index.js",
|
||||
"require": "./lib/index.js",
|
||||
"import": {
|
||||
"types": "./types/index.d.mts",
|
||||
"default": "./es/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./types/index.d.ts",
|
||||
"default": "./lib/index.js"
|
||||
},
|
||||
"browser": "./dist/index.min.js",
|
||||
"umd": "./dist/index.min.js"
|
||||
},
|
||||
"./char": {
|
||||
"types": "./types/char.d.ts",
|
||||
"import": "./es/char.js",
|
||||
"require": "./lib/char.js",
|
||||
"import": {
|
||||
"types": "./types/char.d.mts",
|
||||
"default": "./es/char.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./types/char.d.ts",
|
||||
"default": "./lib/char.js"
|
||||
},
|
||||
"browser": "./dist/index.min.js",
|
||||
"umd": "./dist/index.min.js"
|
||||
},
|
||||
"./helpers": {
|
||||
"types": "./types/helpers.d.ts",
|
||||
"import": "./es/helpers.js",
|
||||
"require": "./lib/helpers.js",
|
||||
"import": {
|
||||
"types": "./types/helpers.d.mts",
|
||||
"default": "./es/helpers.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./types/helpers.d.ts",
|
||||
"default": "./lib/helpers.js"
|
||||
},
|
||||
"browser": "./dist/index.min.js",
|
||||
"umd": "./dist/index.min.js"
|
||||
},
|
||||
"./TagNode": {
|
||||
"types": "./types/TagNode.d.ts",
|
||||
"import": "./es/TagNode.js",
|
||||
"require": "./lib/TagNode.js",
|
||||
"import": {
|
||||
"types": "./types/TagNode.d.mts",
|
||||
"default": "./es/TagNode.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./types/TagNode.d.ts",
|
||||
"default": "./lib/TagNode.js"
|
||||
},
|
||||
"browser": "./dist/index.min.js",
|
||||
"umd": "./dist/index.min.js"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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 {
|
||||
getUniqAttr,
|
||||
getNodeLength,
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
attrsToString,
|
||||
attrValue,
|
||||
isTagNode,
|
||||
} from './helpers';
|
||||
} from './helpers.js';
|
||||
|
||||
const getTagAttrs = <AttrValue>(tag: string, params: Record<string, AttrValue>) => {
|
||||
const uniqAttr = getUniqAttr(params);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { NodeContent, StringNode } from "@bbob/types";
|
||||
|
||||
import { N } from './char';
|
||||
import type { TagNode } from "./TagNode";
|
||||
import { N } from './char.js';
|
||||
import type { TagNode } from "./TagNode.js";
|
||||
|
||||
function isTagNode(el: unknown): el is TagNode {
|
||||
return typeof el === 'object' && el !== null && 'tag' in el;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from "./helpers";
|
||||
export * from "./char";
|
||||
export * from "./TagNode";
|
||||
export * from "./helpers.js";
|
||||
export * from "./char.js";
|
||||
export * from "./TagNode.js";
|
||||
|
||||
Reference in New Issue
Block a user