Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vue-macros/reactivity-transform

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue-macros/reactivity-transform - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

dist/api.cjs

24

dist/api.js

@@ -1,12 +0,12 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkNHZ6TYTOjs = require('./chunk-NHZ6TYTO.js');
exports.shouldTransform = _chunkNHZ6TYTOjs.shouldTransform; exports.transform = _chunkNHZ6TYTOjs.transform; exports.transformAST = _chunkNHZ6TYTOjs.transformAST; exports.transformVueSFC = _chunkNHZ6TYTOjs.transformVueSFC;
import {
shouldTransform,
transform,
transformAST,
transformVueSFC
} from "./chunk-NHZ6TYTO.js";
export {
shouldTransform,
transform,
transformAST,
transformVueSFC
};

@@ -1,25 +0,25 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/core/helper/code.ts?raw
// src/core/helper/code.ts?raw
var code_default = "export function createPropsRestProxy(props,excludedKeys){const ret=Object.create(null);for(const key in props){if(!excludedKeys.includes(key)){Object.defineProperty(ret,key,{enumerable:true,get:()=>props[key]})}}return ret}\n";
// src/core/helper/index.ts
var _common = require('@vue-macros/common');
var helperId = `${_common.VIRTUAL_ID_PREFIX}/reactivity-transform/helper`;
import { VIRTUAL_ID_PREFIX } from "@vue-macros/common";
var helperId = `${VIRTUAL_ID_PREFIX}/reactivity-transform/helper`;
// src/core/transform.ts
var _parser = require('@babel/parser');
var _compilercore = require('@vue/compiler-core');
var _shared = require('@vue/shared');
var _magicstring = require('magic-string'); var _magicstring2 = _interopRequireDefault(_magicstring);
import { parse } from "@babel/parser";
import {
isFunctionType,
TS_NODE_TYPES,
unwrapTSNode,
walkAST
} from "@vue-macros/common";
import {
extractIdentifiers,
isInDestructureAssignment,
isReferencedIdentifier,
isStaticProperty,
walkFunctionParams
} from "@vue/compiler-core";
import { genPropsAccessExp, hasOwn, isArray, isString } from "@vue/shared";
import MagicStringAST from "magic-string";
var CONVERT_SYMBOL = "$";

@@ -52,7 +52,7 @@ var ESCAPE_SYMBOL = "$$";

}
const ast = _parser.parse.call(void 0, src, {
const ast = parse(src, {
sourceType: "module",
plugins
});
const s = new (0, _magicstring2.default)(src);
const s = new MagicStringAST(src);
const res = transformAST(ast.program, s, 0);

@@ -188,3 +188,3 @@ if (res.importedHelpers.length > 0) {

function findUpParent() {
return parentStack.slice().reverse().find(({ type }) => !_common.TS_NODE_TYPES.includes(type));
return parentStack.slice().reverse().find(({ type }) => !TS_NODE_TYPES.includes(type));
}

@@ -213,3 +213,3 @@ function walkScope(node, isRoot = false) {

let refCall;
const init = decl.init ? _common.unwrapTSNode.call(void 0, decl.init) : null;
const init = decl.init ? unwrapTSNode(decl.init) : null;
const isCall = init && init.type === "CallExpression" && init.callee.type === "Identifier";

@@ -226,3 +226,3 @@ if (isCall && (refCall = isRefCreationCall(init.callee.name))) {

const isProps = isRoot && isCall && init.callee.name === "defineProps";
for (const id of _compilercore.extractIdentifiers.call(void 0, decl.id)) {
for (const id of extractIdentifiers(decl.id)) {
if (isProps) {

@@ -316,3 +316,3 @@ excludedIds.add(id);

const source = pathToString(tempVar, path);
const keyStr = _shared.isString.call(void 0, key) ? `'${key}'` : key ? snip(key) : `'${nameId.name}'`;
const keyStr = isString(key) ? `'${key}'` : key ? snip(key) : `'${nameId.name}'`;
const defaultStr = defaultValue ? `, ${snip(defaultValue)}` : ``;

@@ -374,3 +374,3 @@ s.appendLeft(

for (const seg of path) {
if (_shared.isArray.call(void 0, seg)) {
if (isArray(seg)) {
source = `(${source}${segToString(seg[0])} || ${snip(seg[1])})`;

@@ -394,3 +394,3 @@ } else {

function rewriteId(scope, id, parent, parentStack2) {
if (_shared.hasOwn.call(void 0, scope, id.name)) {
if (hasOwn(scope, id.name)) {
const binding = scope[id.name];

@@ -402,4 +402,4 @@ if (binding) {

const { isProp } = binding;
if (_compilercore.isStaticProperty.call(void 0, parent) && parent.shorthand) {
if (!parent.inPattern || _compilercore.isInDestructureAssignment.call(void 0, parent, parentStack2)) {
if (isStaticProperty(parent) && parent.shorthand) {
if (!parent.inPattern || isInDestructureAssignment(parent, parentStack2)) {
if (isProp) {

@@ -415,3 +415,3 @@ if (escapeScope) {

id.end + offset,
`: ${_shared.genPropsAccessExp.call(void 0, propsLocalToPublicMap[id.name])}`
`: ${genPropsAccessExp(propsLocalToPublicMap[id.name])}`
);

@@ -435,3 +435,3 @@ }

id.end + offset,
_shared.genPropsAccessExp.call(void 0, propsLocalToPublicMap[id.name])
genPropsAccessExp(propsLocalToPublicMap[id.name])
);

@@ -462,8 +462,8 @@ }

walkScope(ast, true);
_common.walkAST.call(void 0, ast, {
walkAST(ast, {
enter(node, parent) {
parent && parentStack.push(parent);
if (_common.isFunctionType.call(void 0, node)) {
if (isFunctionType(node)) {
scopeStack.push(currentScope = /* @__PURE__ */ Object.create(null));
_compilercore.walkFunctionParams.call(void 0, node, registerBinding);
walkFunctionParams(node, registerBinding);
if (node.body.type === "BlockStatement") {

@@ -482,3 +482,3 @@ walkScope(node.body);

}
if (node.type === "BlockStatement" && !_common.isFunctionType.call(void 0, parent)) {
if (node.type === "BlockStatement" && !isFunctionType(parent)) {
scopeStack.push(currentScope = /* @__PURE__ */ Object.create(null));

@@ -488,3 +488,3 @@ walkScope(node);

}
if (parent && parent.type.startsWith("TS") && !_common.TS_NODE_TYPES.includes(parent.type)) {
if (parent && parent.type.startsWith("TS") && !TS_NODE_TYPES.includes(parent.type)) {
return this.skip();

@@ -496,3 +496,3 @@ }

// if inside $$(), skip unless this is a destructured prop binding
!(escapeScope && (!binding || !binding.isProp)) && _compilercore.isReferencedIdentifier.call(void 0, node, parent, parentStack) && !excludedIds.has(node)
!(escapeScope && (!binding || !binding.isProp)) && isReferencedIdentifier(node, parent, parentStack) && !excludedIds.has(node)
) {

@@ -521,3 +521,3 @@ let i = scopeStack.length;

removeTrailingComma(s, node, offset);
if (_optionalChain([parent2, 'optionalAccess', _ => _.type]) === "ExpressionStatement") {
if (parent2?.type === "ExpressionStatement") {
let i = (node.leadingComments ? node.leadingComments[0].start : node.start) + offset;

@@ -539,3 +539,3 @@ while (i--) {

parent && parentStack.pop();
if (node.type === "BlockStatement" && !_common.isFunctionType.call(void 0, parent) || _common.isFunctionType.call(void 0, node) || node.type === "CatchClause") {
if (node.type === "BlockStatement" && !isFunctionType(parent) || isFunctionType(node) || node.type === "CatchClause") {
scopeStack.pop();

@@ -558,6 +558,6 @@ currentScope = scopeStack.at(-1);

function removeTrailingComma(s, node, offset) {
if (typeof _optionalChain([node, 'access', _2 => _2.extra, 'optionalAccess', _3 => _3.trailingComma]) === "number") {
if (typeof node.extra?.trailingComma === "number") {
s.remove(
_optionalChain([node, 'access', _4 => _4.extra, 'optionalAccess', _5 => _5.trailingComma]) + offset,
_optionalChain([node, 'access', _6 => _6.extra, 'optionalAccess', _7 => _7.trailingComma]) + offset + 1
node.extra?.trailingComma + offset,
node.extra?.trailingComma + offset + 1
);

@@ -568,14 +568,14 @@ }

// src/core/sfc.ts
import {
DEFINE_PROPS,
generateTransform,
importHelperFn,
isCallOf,
MagicStringAST as MagicStringAST2,
parseSFC,
resolveObjectKey
} from "@vue-macros/common";
function transformVueSFC(code, id) {
const s = new (0, _common.MagicStringAST)(code);
const { script, scriptSetup, getScriptAst, getSetupAst } = _common.parseSFC.call(void 0, code, id);
const s = new MagicStringAST2(code);
const { script, scriptSetup, getScriptAst, getSetupAst } = parseSFC(code, id);
let refBindings;

@@ -609,7 +609,7 @@ let propsDestructuredBindings;

}
return _common.generateTransform.call(void 0, s, id);
return generateTransform(s, id);
function processDefineProps(node) {
if (node.type !== "VariableDeclaration") return;
const decl = node.declarations.find(
(decl2) => _common.isCallOf.call(void 0, decl2.init, _common.DEFINE_PROPS)
(decl2) => isCallOf(decl2.init, DEFINE_PROPS)
);

@@ -619,3 +619,3 @@ if (!decl || decl.id.type !== "ObjectPattern") return;

throw new SyntaxError(
`${_common.DEFINE_PROPS}() don't support multiple declarations.`
`${DEFINE_PROPS}() don't support multiple declarations.`
);

@@ -629,6 +629,6 @@ const offset = scriptSetup.loc.start.offset;

try {
propKey = _common.resolveObjectKey.call(void 0, prop);
} catch (e2) {
propKey = resolveObjectKey(prop);
} catch {
throw new SyntaxError(
`${_common.DEFINE_PROPS}() destructure cannot use computed key.`
`${DEFINE_PROPS}() destructure cannot use computed key.`
);

@@ -641,3 +641,3 @@ }

throw new SyntaxError(
`${_common.DEFINE_PROPS}() destructure does not support nested patterns.`
`${DEFINE_PROPS}() destructure does not support nested patterns.`
);

@@ -657,7 +657,7 @@ }

throw new SyntaxError(
`${_common.DEFINE_PROPS}() destructure does not support nested patterns.`
`${DEFINE_PROPS}() destructure does not support nested patterns.`
);
}
if (propKey !== local) {
const toRef = _common.importHelperFn.call(void 0,
const toRef = importHelperFn(
s,

@@ -697,3 +697,3 @@ scriptSetup.loc.start.offset,

node,
`defineProps(${_common.importHelperFn.call(void 0,
`defineProps(${importHelperFn(
s,

@@ -712,3 +712,3 @@ offset,

throw new SyntaxError(
`${_common.DEFINE_PROPS}() must have at least one argument or type argument.`
`${DEFINE_PROPS}() must have at least one argument or type argument.`
);

@@ -726,9 +726,9 @@ }

exports.code_default = code_default; exports.helperId = helperId; exports.shouldTransform = shouldTransform; exports.transform = transform; exports.transformAST = transformAST; exports.transformVueSFC = transformVueSFC;
export {
code_default,
helperId,
shouldTransform,
transform,
transformAST,
transformVueSFC
};

@@ -1,26 +0,26 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
import {
code_default,
helperId,
shouldTransform,
transform,
transformVueSFC
} from "./chunk-NHZ6TYTO.js";
var _chunkNHZ6TYTOjs = require('./chunk-NHZ6TYTO.js');
// src/index.ts
var _common = require('@vue-macros/common');
var _unplugin = require('unplugin');
import {
createFilter,
createRollupFilter,
detectVueVersion,
FilterFileType,
getFilterPattern,
normalizePath,
REGEX_NODE_MODULES
} from "@vue-macros/common";
import {
createUnplugin
} from "unplugin";
function resolveOptions(options, framework) {
const version = options.version || _common.detectVueVersion.call(void 0, );
const include = _common.getFilterPattern.call(void 0,
[_common.FilterFileType.SRC_FILE, _common.FilterFileType.VUE_SFC_WITH_SETUP],
const version = options.version || detectVueVersion();
const include = getFilterPattern(
[FilterFileType.SRC_FILE, FilterFileType.VUE_SFC_WITH_SETUP],
framework

@@ -30,3 +30,3 @@ );

include,
exclude: [_common.REGEX_NODE_MODULES],
exclude: [REGEX_NODE_MODULES],
...options,

@@ -37,9 +37,9 @@ version

var name = "unplugin-vue-reactivity-transform";
var plugin = _unplugin.createUnplugin.call(void 0,
var plugin = createUnplugin(
(userOptions = {}, { framework }) => {
const options = resolveOptions(userOptions, framework);
const filter = _common.createFilter.call(void 0, options);
const filterSFC = _common.createRollupFilter.call(void 0,
_common.getFilterPattern.call(void 0,
[_common.FilterFileType.VUE_SFC_WITH_SETUP, _common.FilterFileType.SETUP_SFC],
const filter = createFilter(options);
const filterSFC = createRollupFilter(
getFilterPattern(
[FilterFileType.VUE_SFC_WITH_SETUP, FilterFileType.SETUP_SFC],
framework

@@ -52,9 +52,9 @@ )

resolveId(id) {
if (id === _common.normalizePath.call(void 0, _chunkNHZ6TYTOjs.helperId)) return id;
if (id === normalizePath(helperId)) return id;
},
loadInclude(id) {
return _common.normalizePath.call(void 0, id) === _chunkNHZ6TYTOjs.helperId;
return normalizePath(id) === helperId;
},
load(id) {
if (_common.normalizePath.call(void 0, id) === _chunkNHZ6TYTOjs.helperId) return _chunkNHZ6TYTOjs.code_default;
if (normalizePath(id) === helperId) return code_default;
},

@@ -64,5 +64,5 @@ transformInclude: filter,

if (filterSFC(id)) {
return _chunkNHZ6TYTOjs.transformVueSFC.call(void 0, code, id);
} else if (_chunkNHZ6TYTOjs.shouldTransform.call(void 0, code)) {
return _chunkNHZ6TYTOjs.transform.call(void 0, code, {
return transformVueSFC(code, id);
} else if (shouldTransform(code)) {
return transform(code, {
filename: id,

@@ -78,4 +78,4 @@ sourceMap: true

exports.src_default = src_default;
export {
src_default
};

@@ -7,2 +7,2 @@ import plugin from './index.js';

export = _default;
export { _default as default };

@@ -1,12 +0,10 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
import {
src_default
} from "./chunk-ZLXUXU3P.js";
import "./chunk-NHZ6TYTO.js";
var _chunkZLXUXU3Pjs = require('./chunk-ZLXUXU3P.js');
require('./chunk-NHZ6TYTO.js');
// src/esbuild.ts
var esbuild_default = _chunkZLXUXU3Pjs.src_default.esbuild;
exports.default = esbuild_default;
module.exports = exports.default;
var esbuild_default = src_default.esbuild;
export {
esbuild_default as default
};

@@ -1,9 +0,7 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkZLXUXU3Pjs = require('./chunk-ZLXUXU3P.js');
require('./chunk-NHZ6TYTO.js');
exports.default = _chunkZLXUXU3Pjs.src_default;
module.exports = exports.default;
import {
src_default
} from "./chunk-ZLXUXU3P.js";
import "./chunk-NHZ6TYTO.js";
export {
src_default as default
};

@@ -7,2 +7,2 @@ import plugin from './index.js';

export = _default;
export { _default as default };

@@ -1,12 +0,10 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
import {
src_default
} from "./chunk-ZLXUXU3P.js";
import "./chunk-NHZ6TYTO.js";
var _chunkZLXUXU3Pjs = require('./chunk-ZLXUXU3P.js');
require('./chunk-NHZ6TYTO.js');
// src/rolldown.ts
var rolldown_default = _chunkZLXUXU3Pjs.src_default.rolldown;
exports.default = rolldown_default;
module.exports = exports.default;
var rolldown_default = src_default.rolldown;
export {
rolldown_default as default
};

@@ -7,2 +7,2 @@ import plugin from './index.js';

export = _default;
export { _default as default };

@@ -1,12 +0,10 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
import {
src_default
} from "./chunk-ZLXUXU3P.js";
import "./chunk-NHZ6TYTO.js";
var _chunkZLXUXU3Pjs = require('./chunk-ZLXUXU3P.js');
require('./chunk-NHZ6TYTO.js');
// src/rollup.ts
var rollup_default = _chunkZLXUXU3Pjs.src_default.rollup;
exports.default = rollup_default;
module.exports = exports.default;
var rollup_default = src_default.rollup;
export {
rollup_default as default
};

@@ -7,2 +7,2 @@ import plugin from './index.js';

export = _default;
export { _default as default };

@@ -1,12 +0,10 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
import {
src_default
} from "./chunk-ZLXUXU3P.js";
import "./chunk-NHZ6TYTO.js";
var _chunkZLXUXU3Pjs = require('./chunk-ZLXUXU3P.js');
require('./chunk-NHZ6TYTO.js');
// src/rspack.ts
var rspack_default = _chunkZLXUXU3Pjs.src_default.rspack;
exports.default = rspack_default;
module.exports = exports.default;
var rspack_default = src_default.rspack;
export {
rspack_default as default
};

@@ -7,2 +7,2 @@ import plugin from './index.js';

export = _default;
export { _default as default };

@@ -1,12 +0,10 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
import {
src_default
} from "./chunk-ZLXUXU3P.js";
import "./chunk-NHZ6TYTO.js";
var _chunkZLXUXU3Pjs = require('./chunk-ZLXUXU3P.js');
require('./chunk-NHZ6TYTO.js');
// src/vite.ts
var vite_default = _chunkZLXUXU3Pjs.src_default.vite;
exports.default = vite_default;
module.exports = exports.default;
var vite_default = src_default.vite;
export {
vite_default as default
};

@@ -7,2 +7,2 @@ import plugin from './index.js';

export = _default;
export { _default as default };

@@ -1,12 +0,10 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
import {
src_default
} from "./chunk-ZLXUXU3P.js";
import "./chunk-NHZ6TYTO.js";
var _chunkZLXUXU3Pjs = require('./chunk-ZLXUXU3P.js');
require('./chunk-NHZ6TYTO.js');
// src/webpack.ts
var webpack_default = _chunkZLXUXU3Pjs.src_default.webpack;
exports.default = webpack_default;
module.exports = exports.default;
var webpack_default = src_default.webpack;
export {
webpack_default as default
};
{
"name": "@vue-macros/reactivity-transform",
"version": "1.0.4",
"version": "1.1.0",
"description": "reactivity-transform feature from Vue Macros.",
"type": "commonjs",
"type": "module",
"keywords": [

@@ -31,37 +31,37 @@ "vue-macros",

],
"main": "dist/index.js",
"module": "dist/index.mjs",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs"
"require": "./dist/index.cjs",
"import": "./dist/index.js"
},
"./api": {
"require": "./dist/api.js",
"import": "./dist/api.mjs"
"require": "./dist/api.cjs",
"import": "./dist/api.js"
},
"./esbuild": {
"require": "./dist/esbuild.js",
"import": "./dist/esbuild.mjs"
"require": "./dist/esbuild.cjs",
"import": "./dist/esbuild.js"
},
"./rolldown": {
"require": "./dist/rolldown.js",
"import": "./dist/rolldown.mjs"
"require": "./dist/rolldown.cjs",
"import": "./dist/rolldown.js"
},
"./rollup": {
"require": "./dist/rollup.js",
"import": "./dist/rollup.mjs"
"require": "./dist/rollup.cjs",
"import": "./dist/rollup.js"
},
"./rspack": {
"require": "./dist/rspack.js",
"import": "./dist/rspack.mjs"
"require": "./dist/rspack.cjs",
"import": "./dist/rspack.js"
},
"./vite": {
"require": "./dist/vite.js",
"import": "./dist/vite.mjs"
"require": "./dist/vite.cjs",
"import": "./dist/vite.js"
},
"./webpack": {
"require": "./dist/webpack.js",
"import": "./dist/webpack.mjs"
"require": "./dist/webpack.cjs",
"import": "./dist/webpack.js"
},

@@ -89,7 +89,7 @@ "./*": [

"@babel/parser": "^7.25.6",
"@vue/compiler-core": "^3.5.3",
"@vue/shared": "^3.5.3",
"@vue/compiler-core": "^3.5.4",
"@vue/shared": "^3.5.4",
"magic-string": "^0.30.11",
"unplugin": "^1.13.1",
"@vue-macros/common": "1.12.3"
"unplugin": "^1.14.1",
"@vue-macros/common": "1.13.0"
},

@@ -96,0 +96,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc