unplugin-jsx-string
Advanced tools
Comparing version 0.6.0 to 0.7.0
export { transformJsxToString } from './core/convert.js'; | ||
import 'magic-string'; | ||
import './core/utils.js'; | ||
@@ -4,0 +3,0 @@ import './core/options.js'; |
@@ -21,2 +21,6 @@ "use strict"; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -38,4 +42,4 @@ mod | ||
var import_entities = require("entities"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
var import_types = require("@babel/types"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
@@ -46,3 +50,3 @@ // src/core/utils.ts | ||
function kebabCase(str) { | ||
return str.replace(KEBAB_REGEX, (match) => { | ||
return str.replaceAll(KEBAB_REGEX, (match) => { | ||
return `-${match.toLowerCase()}`; | ||
@@ -59,3 +63,3 @@ }); | ||
}); | ||
return text.replace(RAW_RE, "${$1}"); | ||
return text.replaceAll(RAW_RE, "${$1}"); | ||
}; | ||
@@ -177,3 +181,2 @@ var isPrimitive = (val) => { | ||
function resolveJsx(node2) { | ||
var _a; | ||
switch (node2.type) { | ||
@@ -187,3 +190,3 @@ case "JSXElement": | ||
case "JSXEmptyExpression": | ||
return ((_a = node2.innerComments) == null ? void 0 : _a.map((comment) => `<!--${comment.value}-->`).join("")) ?? ""; | ||
return node2.innerComments?.map((comment) => `<!--${comment.value}-->`).join("") ?? ""; | ||
case "JSXExpressionContainer": { | ||
@@ -218,3 +221,3 @@ return resolveExpression(node2.expression); | ||
); | ||
return expressions.slice(-1)[0]; | ||
return expressions.at(-1); | ||
} | ||
@@ -221,0 +224,0 @@ case "ParenthesizedExpression": |
@@ -1,2 +0,1 @@ | ||
import * as magic_string from 'magic-string'; | ||
import { Primitive } from './utils.js'; | ||
@@ -12,5 +11,5 @@ import { OptionsResolved } from './options.js'; | ||
code: string; | ||
readonly map: magic_string.SourceMap; | ||
readonly map: any; | ||
}; | ||
export { EvaluatedValue, transformJsxToString }; |
@@ -21,2 +21,6 @@ "use strict"; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -36,4 +40,4 @@ mod | ||
var import_entities = require("entities"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
var import_types = require("@babel/types"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
@@ -44,3 +48,3 @@ // src/core/utils.ts | ||
function kebabCase(str) { | ||
return str.replace(KEBAB_REGEX, (match) => { | ||
return str.replaceAll(KEBAB_REGEX, (match) => { | ||
return `-${match.toLowerCase()}`; | ||
@@ -57,3 +61,3 @@ }); | ||
}); | ||
return text.replace(RAW_RE, "${$1}"); | ||
return text.replaceAll(RAW_RE, "${$1}"); | ||
}; | ||
@@ -175,3 +179,2 @@ var isPrimitive = (val) => { | ||
function resolveJsx(node2) { | ||
var _a; | ||
switch (node2.type) { | ||
@@ -185,3 +188,3 @@ case "JSXElement": | ||
case "JSXEmptyExpression": | ||
return ((_a = node2.innerComments) == null ? void 0 : _a.map((comment) => `<!--${comment.value}-->`).join("")) ?? ""; | ||
return node2.innerComments?.map((comment) => `<!--${comment.value}-->`).join("") ?? ""; | ||
case "JSXExpressionContainer": { | ||
@@ -216,3 +219,3 @@ return resolveExpression(node2.expression); | ||
); | ||
return expressions.slice(-1)[0]; | ||
return expressions.at(-1); | ||
} | ||
@@ -219,0 +222,0 @@ case "ParenthesizedExpression": |
@@ -21,2 +21,6 @@ "use strict"; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -40,3 +44,3 @@ mod | ||
function kebabCase(str) { | ||
return str.replace(KEBAB_REGEX, (match) => { | ||
return str.replaceAll(KEBAB_REGEX, (match) => { | ||
return `-${match.toLowerCase()}`; | ||
@@ -53,3 +57,3 @@ }); | ||
}); | ||
return text.replace(RAW_RE, "${$1}"); | ||
return text.replaceAll(RAW_RE, "${$1}"); | ||
}; | ||
@@ -56,0 +60,0 @@ var isPrimitive = (val) => { |
@@ -21,2 +21,6 @@ "use strict"; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -42,4 +46,4 @@ mod | ||
var import_entities = require("entities"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
var import_types = require("@babel/types"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
@@ -50,3 +54,3 @@ // src/core/utils.ts | ||
function kebabCase(str) { | ||
return str.replace(KEBAB_REGEX, (match) => { | ||
return str.replaceAll(KEBAB_REGEX, (match) => { | ||
return `-${match.toLowerCase()}`; | ||
@@ -63,3 +67,3 @@ }); | ||
}); | ||
return text.replace(RAW_RE, "${$1}"); | ||
return text.replaceAll(RAW_RE, "${$1}"); | ||
}; | ||
@@ -181,3 +185,2 @@ var isPrimitive = (val) => { | ||
function resolveJsx(node2) { | ||
var _a; | ||
switch (node2.type) { | ||
@@ -191,3 +194,3 @@ case "JSXElement": | ||
case "JSXEmptyExpression": | ||
return ((_a = node2.innerComments) == null ? void 0 : _a.map((comment) => `<!--${comment.value}-->`).join("")) ?? ""; | ||
return node2.innerComments?.map((comment) => `<!--${comment.value}-->`).join("") ?? ""; | ||
case "JSXExpressionContainer": { | ||
@@ -222,3 +225,3 @@ return resolveExpression(node2.expression); | ||
); | ||
return expressions.slice(-1)[0]; | ||
return expressions.at(-1); | ||
} | ||
@@ -442,4 +445,2 @@ case "ParenthesizedExpression": | ||
var esbuild_default = src_default.esbuild; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); | ||
exports.default = module.exports; |
@@ -21,2 +21,6 @@ "use strict"; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -40,4 +44,4 @@ mod | ||
var import_entities = require("entities"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
var import_types = require("@babel/types"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
@@ -48,3 +52,3 @@ // src/core/utils.ts | ||
function kebabCase(str) { | ||
return str.replace(KEBAB_REGEX, (match) => { | ||
return str.replaceAll(KEBAB_REGEX, (match) => { | ||
return `-${match.toLowerCase()}`; | ||
@@ -61,3 +65,3 @@ }); | ||
}); | ||
return text.replace(RAW_RE, "${$1}"); | ||
return text.replaceAll(RAW_RE, "${$1}"); | ||
}; | ||
@@ -179,3 +183,2 @@ var isPrimitive = (val) => { | ||
function resolveJsx(node2) { | ||
var _a; | ||
switch (node2.type) { | ||
@@ -189,3 +192,3 @@ case "JSXElement": | ||
case "JSXEmptyExpression": | ||
return ((_a = node2.innerComments) == null ? void 0 : _a.map((comment) => `<!--${comment.value}-->`).join("")) ?? ""; | ||
return node2.innerComments?.map((comment) => `<!--${comment.value}-->`).join("") ?? ""; | ||
case "JSXExpressionContainer": { | ||
@@ -220,3 +223,3 @@ return resolveExpression(node2.expression); | ||
); | ||
return expressions.slice(-1)[0]; | ||
return expressions.at(-1); | ||
} | ||
@@ -437,3 +440,1 @@ case "ParenthesizedExpression": | ||
}); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); |
@@ -1,2 +0,2 @@ | ||
import * as unplugin from 'unplugin'; | ||
import * as rollup from 'rollup'; | ||
import { Options } from './core/options.js'; | ||
@@ -6,4 +6,4 @@ import '@babel/parser'; | ||
declare const _default: (options: Options) => unplugin.RollupPlugin | unplugin.RollupPlugin[]; | ||
declare const _default: (options: Options) => rollup.Plugin | rollup.Plugin[]; | ||
export { _default as default }; |
@@ -21,2 +21,6 @@ "use strict"; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -42,4 +46,4 @@ mod | ||
var import_entities = require("entities"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
var import_types = require("@babel/types"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
@@ -50,3 +54,3 @@ // src/core/utils.ts | ||
function kebabCase(str) { | ||
return str.replace(KEBAB_REGEX, (match) => { | ||
return str.replaceAll(KEBAB_REGEX, (match) => { | ||
return `-${match.toLowerCase()}`; | ||
@@ -63,3 +67,3 @@ }); | ||
}); | ||
return text.replace(RAW_RE, "${$1}"); | ||
return text.replaceAll(RAW_RE, "${$1}"); | ||
}; | ||
@@ -181,3 +185,2 @@ var isPrimitive = (val) => { | ||
function resolveJsx(node2) { | ||
var _a; | ||
switch (node2.type) { | ||
@@ -191,3 +194,3 @@ case "JSXElement": | ||
case "JSXEmptyExpression": | ||
return ((_a = node2.innerComments) == null ? void 0 : _a.map((comment) => `<!--${comment.value}-->`).join("")) ?? ""; | ||
return node2.innerComments?.map((comment) => `<!--${comment.value}-->`).join("") ?? ""; | ||
case "JSXExpressionContainer": { | ||
@@ -222,3 +225,3 @@ return resolveExpression(node2.expression); | ||
); | ||
return expressions.slice(-1)[0]; | ||
return expressions.at(-1); | ||
} | ||
@@ -442,4 +445,2 @@ case "ParenthesizedExpression": | ||
var rollup_default = src_default.rollup; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); | ||
exports.default = module.exports; |
@@ -21,2 +21,6 @@ "use strict"; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -42,4 +46,4 @@ mod | ||
var import_entities = require("entities"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
var import_types = require("@babel/types"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
@@ -50,3 +54,3 @@ // src/core/utils.ts | ||
function kebabCase(str) { | ||
return str.replace(KEBAB_REGEX, (match) => { | ||
return str.replaceAll(KEBAB_REGEX, (match) => { | ||
return `-${match.toLowerCase()}`; | ||
@@ -63,3 +67,3 @@ }); | ||
}); | ||
return text.replace(RAW_RE, "${$1}"); | ||
return text.replaceAll(RAW_RE, "${$1}"); | ||
}; | ||
@@ -181,3 +185,2 @@ var isPrimitive = (val) => { | ||
function resolveJsx(node2) { | ||
var _a; | ||
switch (node2.type) { | ||
@@ -191,3 +194,3 @@ case "JSXElement": | ||
case "JSXEmptyExpression": | ||
return ((_a = node2.innerComments) == null ? void 0 : _a.map((comment) => `<!--${comment.value}-->`).join("")) ?? ""; | ||
return node2.innerComments?.map((comment) => `<!--${comment.value}-->`).join("") ?? ""; | ||
case "JSXExpressionContainer": { | ||
@@ -222,3 +225,3 @@ return resolveExpression(node2.expression); | ||
); | ||
return expressions.slice(-1)[0]; | ||
return expressions.at(-1); | ||
} | ||
@@ -442,4 +445,2 @@ case "ParenthesizedExpression": | ||
var vite_default = src_default.vite; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); | ||
exports.default = module.exports; |
@@ -21,2 +21,6 @@ "use strict"; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -42,4 +46,4 @@ mod | ||
var import_entities = require("entities"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
var import_types = require("@babel/types"); | ||
var import_magic_string = __toESM(require("magic-string")); | ||
@@ -50,3 +54,3 @@ // src/core/utils.ts | ||
function kebabCase(str) { | ||
return str.replace(KEBAB_REGEX, (match) => { | ||
return str.replaceAll(KEBAB_REGEX, (match) => { | ||
return `-${match.toLowerCase()}`; | ||
@@ -63,3 +67,3 @@ }); | ||
}); | ||
return text.replace(RAW_RE, "${$1}"); | ||
return text.replaceAll(RAW_RE, "${$1}"); | ||
}; | ||
@@ -181,3 +185,2 @@ var isPrimitive = (val) => { | ||
function resolveJsx(node2) { | ||
var _a; | ||
switch (node2.type) { | ||
@@ -191,3 +194,3 @@ case "JSXElement": | ||
case "JSXEmptyExpression": | ||
return ((_a = node2.innerComments) == null ? void 0 : _a.map((comment) => `<!--${comment.value}-->`).join("")) ?? ""; | ||
return node2.innerComments?.map((comment) => `<!--${comment.value}-->`).join("") ?? ""; | ||
case "JSXExpressionContainer": { | ||
@@ -222,3 +225,3 @@ return resolveExpression(node2.expression); | ||
); | ||
return expressions.slice(-1)[0]; | ||
return expressions.at(-1); | ||
} | ||
@@ -442,4 +445,2 @@ case "ParenthesizedExpression": | ||
var webpack_default = src_default.webpack; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); | ||
exports.default = module.exports; |
{ | ||
"name": "unplugin-jsx-string", | ||
"version": "0.6.0", | ||
"packageManager": "pnpm@7.25.1", | ||
"version": "0.7.0", | ||
"packageManager": "pnpm@8.6.5", | ||
"description": "Converts JSX to HTML strings at compile time.", | ||
@@ -16,9 +16,9 @@ "keywords": [ | ||
"license": "MIT", | ||
"homepage": "https://github.com/sxzz/unplugin-vue#readme", | ||
"homepage": "https://github.com/sxzz/unplugin-jsx-string#readme", | ||
"bugs": { | ||
"url": "https://github.com/sxzz/unplugin-vue/issues" | ||
"url": "https://github.com/sxzz/unplugin-jsx-string/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/sxzz/unplugin-vue.git" | ||
"url": "git+https://github.com/sxzz/unplugin-jsx-string.git" | ||
}, | ||
@@ -65,2 +65,10 @@ "author": "三咲智子 <sxzz@sxzz.moe>", | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"./dist/*", | ||
"./*" | ||
] | ||
} | ||
}, | ||
"publishConfig": { | ||
@@ -70,35 +78,37 @@ "access": "public" | ||
"dependencies": { | ||
"@babel/parser": "^7.20.13", | ||
"@babel/types": "^7.20.7", | ||
"@babel/parser": "^7.22.7", | ||
"@babel/types": "^7.22.5", | ||
"@rollup/pluginutils": "^5.0.2", | ||
"entities": "^4.4.0", | ||
"entities": "^4.5.0", | ||
"estree-walker": "^3.0.3", | ||
"jsesc": "^3.0.2", | ||
"magic-string": "^0.27.0", | ||
"unplugin": "^1.0.1" | ||
"magic-string": "^0.30.1", | ||
"unplugin": "^1.3.2" | ||
}, | ||
"devDependencies": { | ||
"@sxzz/eslint-config": "^2.4.4", | ||
"@sxzz/eslint-config": "^3.1.0", | ||
"@sxzz/prettier-config": "^1.0.3", | ||
"@types/benchmark": "^2.1.2", | ||
"@types/jsesc": "^3.0.1", | ||
"@types/node": "^18.11.18", | ||
"@types/react": "^18.0.27", | ||
"@types/node": "^20.4.0", | ||
"@types/react": "^18.2.14", | ||
"benchmark": "^2.1.4", | ||
"bumpp": "^8.2.1", | ||
"eslint": "^8.32.0", | ||
"eslint-define-config": "^1.14.0", | ||
"fast-glob": "^3.2.12", | ||
"prettier": "^2.8.3", | ||
"tsup": "^6.5.0", | ||
"tsx": "^3.12.2", | ||
"typescript": "^5.0.0-beta", | ||
"vite": "^4.0.4", | ||
"vitest": "^0.28.3" | ||
"bumpp": "^9.1.1", | ||
"eslint": "^8.44.0", | ||
"eslint-define-config": "^1.21.0", | ||
"fast-glob": "^3.3.0", | ||
"prettier": "^3.0.0", | ||
"tsup": "^7.1.0", | ||
"tsx": "^3.12.7", | ||
"typescript": "^5.1.6", | ||
"vite": "^4.4.1", | ||
"vitest": "^0.33.0" | ||
}, | ||
"engines": { | ||
"node": ">=14.19.0" | ||
"node": ">=16.14.0" | ||
}, | ||
"prettier": "@sxzz/prettier-config", | ||
"scripts": { | ||
"lint": "eslint . --ext .vue,.js,.ts,.jsx,.tsx,.json,.md", | ||
"lint:fix": "pnpm run lint -- --fix", | ||
"lint": "eslint --cache .", | ||
"lint:fix": "pnpm run lint --fix", | ||
"build": "tsup && tsx scripts/postbuild.mts", | ||
@@ -105,0 +115,0 @@ "dev": "pnpm run -C playground dev", |
@@ -126,3 +126,2 @@ # unplugin-jsx-string [![npm](https://img.shields.io/npm/v/unplugin-jsx-string.svg)](https://npmjs.com/package/unplugin-jsx-string) | ||
## Benchmark | ||
@@ -138,3 +137,3 @@ | ||
*More samples are welcome.* | ||
_More samples are welcome._ | ||
</small> | ||
@@ -152,2 +151,2 @@ | ||
[MIT](./LICENSE) License © 2022 [三咲智子](https://github.com/sxzz) | ||
[MIT](./LICENSE) License © 2022-PRESENT [三咲智子](https://github.com/sxzz) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
136339
44
4055
17
7
150
+ Addedmagic-string@0.30.14(transitive)
- Removedmagic-string@0.27.0(transitive)
Updated@babel/parser@^7.22.7
Updated@babel/types@^7.22.5
Updatedentities@^4.5.0
Updatedmagic-string@^0.30.1
Updatedunplugin@^1.3.2