@vue-macros/common
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -150,16 +150,2 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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/index.ts | ||
function getTransformResult(s, id) { | ||
if (_optionalChain([s, 'optionalAccess', _8 => _8.hasChanged, 'call', _9 => _9()])) { | ||
return { | ||
code: s.toString(), | ||
get map() { | ||
return s.generateMap({ | ||
source: id, | ||
includeContent: true, | ||
hires: true | ||
}); | ||
} | ||
}; | ||
} | ||
} | ||
function createFilter(options) { | ||
@@ -179,4 +165,4 @@ return _pluginutils.createFilter.call(void 0, options.include, options.exclude); | ||
const { descriptor, errors } = sfc; | ||
const scriptLang = _optionalChain([sfc, 'access', _10 => _10.descriptor, 'access', _11 => _11.script, 'optionalAccess', _12 => _12.lang]); | ||
const scriptSetupLang = _optionalChain([sfc, 'access', _13 => _13.descriptor, 'access', _14 => _14.scriptSetup, 'optionalAccess', _15 => _15.lang]); | ||
const scriptLang = _optionalChain([sfc, 'access', _8 => _8.descriptor, 'access', _9 => _9.script, 'optionalAccess', _10 => _10.lang]); | ||
const scriptSetupLang = _optionalChain([sfc, 'access', _11 => _11.descriptor, 'access', _12 => _12.scriptSetup, 'optionalAccess', _13 => _13.lang]); | ||
if (sfc.descriptor.script && sfc.descriptor.scriptSetup && (scriptLang || "js") !== (scriptSetupLang || "js")) { | ||
@@ -193,3 +179,3 @@ throw new Error( | ||
errors, | ||
offset: _nullishCoalesce(_optionalChain([descriptor, 'access', _16 => _16.scriptSetup, 'optionalAccess', _17 => _17.loc, 'access', _18 => _18.start, 'access', _19 => _19.offset]), () => ( 0)), | ||
offset: _nullishCoalesce(_optionalChain([descriptor, 'access', _14 => _14.scriptSetup, 'optionalAccess', _15 => _15.loc, 'access', _16 => _16.start, 'access', _17 => _17.offset]), () => ( 0)), | ||
getSetupAst() { | ||
@@ -219,3 +205,3 @@ if (!descriptor.scriptSetup) | ||
const sfc = parseSFC(code, id); | ||
const scriptCode = _nullishCoalesce(_optionalChain([sfc, 'access', _20 => _20.script, 'optionalAccess', _21 => _21.content]), () => ( "")); | ||
const scriptCode = _nullishCoalesce(_optionalChain([sfc, 'access', _18 => _18.script, 'optionalAccess', _19 => _19.content]), () => ( "")); | ||
return { | ||
@@ -246,3 +232,3 @@ code: sfc.scriptSetup ? `${scriptCode} | ||
function removeMacroImport(node, s, offset) { | ||
if (node.type === "ImportDeclaration" && _optionalChain([node, 'access', _22 => _22.attributes, 'optionalAccess', _23 => _23.some, 'call', _24 => _24( | ||
if (node.type === "ImportDeclaration" && _optionalChain([node, 'access', _20 => _20.attributes, 'optionalAccess', _21 => _21.some, 'call', _22 => _22( | ||
(attr) => _astkit.resolveString.call(void 0, attr.key) === "type" && attr.value.value === "macro" | ||
@@ -289,3 +275,2 @@ )])) { | ||
exports.DEFINE_EMIT = DEFINE_EMIT; exports.DEFINE_EMITS = DEFINE_EMITS; exports.DEFINE_MODELS = DEFINE_MODELS; exports.DEFINE_MODELS_DOLLAR = DEFINE_MODELS_DOLLAR; exports.DEFINE_OPTIONS = DEFINE_OPTIONS; exports.DEFINE_PROP = DEFINE_PROP; exports.DEFINE_PROPS = DEFINE_PROPS; exports.DEFINE_PROPS_DOLLAR = DEFINE_PROPS_DOLLAR; exports.DEFINE_PROPS_REFS = DEFINE_PROPS_REFS; exports.DEFINE_RENDER = DEFINE_RENDER; exports.DEFINE_SETUP_COMPONENT = DEFINE_SETUP_COMPONENT; exports.DEFINE_SLOTS = DEFINE_SLOTS; exports.HELPER_PREFIX = HELPER_PREFIX; exports.REGEX_NODE_MODULES = REGEX_NODE_MODULES; exports.REGEX_SETUP_SFC = REGEX_SETUP_SFC; exports.REGEX_SRC_FILE = REGEX_SRC_FILE; exports.REGEX_SUPPORTED_EXT = REGEX_SUPPORTED_EXT; exports.REGEX_VUE_SFC = REGEX_VUE_SFC; exports.REGEX_VUE_SUB = REGEX_VUE_SUB; exports.REPO_ISSUE_URL = REPO_ISSUE_URL; exports.VIRTUAL_ID_PREFIX = VIRTUAL_ID_PREFIX; exports.WITH_DEFAULTS = WITH_DEFAULTS; exports.addNormalScript = addNormalScript; exports.checkInvalidScopeReference = checkInvalidScopeReference; exports.createFilter = createFilter; exports.detectVueVersion = detectVueVersion; exports.getFileCodeAndLang = getFileCodeAndLang; exports.getTransformResult = getTransformResult; exports.importHelperFn = importHelperFn; exports.isStaticExpression = isStaticExpression; exports.isStaticObjectKey = isStaticObjectKey; exports.normalizePath = _pluginutils.normalizePath; exports.parseSFC = parseSFC; exports.removeMacroImport = removeMacroImport; exports.resolveObjectExpression = resolveObjectExpression; | ||
exports.DEFINE_EMIT = DEFINE_EMIT; exports.DEFINE_EMITS = DEFINE_EMITS; exports.DEFINE_MODELS = DEFINE_MODELS; exports.DEFINE_MODELS_DOLLAR = DEFINE_MODELS_DOLLAR; exports.DEFINE_OPTIONS = DEFINE_OPTIONS; exports.DEFINE_PROP = DEFINE_PROP; exports.DEFINE_PROPS = DEFINE_PROPS; exports.DEFINE_PROPS_DOLLAR = DEFINE_PROPS_DOLLAR; exports.DEFINE_PROPS_REFS = DEFINE_PROPS_REFS; exports.DEFINE_RENDER = DEFINE_RENDER; exports.DEFINE_SETUP_COMPONENT = DEFINE_SETUP_COMPONENT; exports.DEFINE_SLOTS = DEFINE_SLOTS; exports.HELPER_PREFIX = HELPER_PREFIX; exports.REGEX_NODE_MODULES = REGEX_NODE_MODULES; exports.REGEX_SETUP_SFC = REGEX_SETUP_SFC; exports.REGEX_SRC_FILE = REGEX_SRC_FILE; exports.REGEX_SUPPORTED_EXT = REGEX_SUPPORTED_EXT; exports.REGEX_VUE_SFC = REGEX_VUE_SFC; exports.REGEX_VUE_SUB = REGEX_VUE_SUB; exports.REPO_ISSUE_URL = REPO_ISSUE_URL; exports.VIRTUAL_ID_PREFIX = VIRTUAL_ID_PREFIX; exports.WITH_DEFAULTS = WITH_DEFAULTS; exports.addNormalScript = addNormalScript; exports.checkInvalidScopeReference = checkInvalidScopeReference; exports.createFilter = createFilter; exports.detectVueVersion = detectVueVersion; exports.getFileCodeAndLang = getFileCodeAndLang; exports.importHelperFn = importHelperFn; exports.isStaticExpression = isStaticExpression; exports.isStaticObjectKey = isStaticObjectKey; exports.normalizePath = _pluginutils.normalizePath; exports.parseSFC = parseSFC; exports.removeMacroImport = removeMacroImport; exports.resolveObjectExpression = resolveObjectExpression; |
@@ -51,6 +51,2 @@ import { MagicStringBase, MagicString } from 'magic-string-ast'; | ||
declare function getTransformResult(s: MagicStringBase | undefined, id: string): { | ||
code: string; | ||
map: any; | ||
} | undefined; | ||
interface BaseOptions { | ||
@@ -84,2 +80,2 @@ include?: FilterPattern; | ||
export { BaseOptions, DEFINE_EMIT, DEFINE_EMITS, DEFINE_MODELS, DEFINE_MODELS_DOLLAR, DEFINE_OPTIONS, DEFINE_PROP, DEFINE_PROPS, DEFINE_PROPS_DOLLAR, DEFINE_PROPS_REFS, DEFINE_RENDER, DEFINE_SETUP_COMPONENT, DEFINE_SLOTS, HELPER_PREFIX, MarkRequired, Overwrite, REGEX_NODE_MODULES, REGEX_SETUP_SFC, REGEX_SRC_FILE, REGEX_SUPPORTED_EXT, REGEX_VUE_SFC, REGEX_VUE_SUB, REPO_ISSUE_URL, RecordToUnion, SFC, SFCScriptBlock, UnionToIntersection, VIRTUAL_ID_PREFIX, WITH_DEFAULTS, addNormalScript, checkInvalidScopeReference, createFilter, detectVueVersion, getFileCodeAndLang, getTransformResult, importHelperFn, isStaticExpression, isStaticObjectKey, parseSFC, removeMacroImport, resolveObjectExpression }; | ||
export { BaseOptions, DEFINE_EMIT, DEFINE_EMITS, DEFINE_MODELS, DEFINE_MODELS_DOLLAR, DEFINE_OPTIONS, DEFINE_PROP, DEFINE_PROPS, DEFINE_PROPS_DOLLAR, DEFINE_PROPS_REFS, DEFINE_RENDER, DEFINE_SETUP_COMPONENT, DEFINE_SLOTS, HELPER_PREFIX, MarkRequired, Overwrite, REGEX_NODE_MODULES, REGEX_SETUP_SFC, REGEX_SRC_FILE, REGEX_SUPPORTED_EXT, REGEX_VUE_SFC, REGEX_VUE_SUB, REPO_ISSUE_URL, RecordToUnion, SFC, SFCScriptBlock, UnionToIntersection, VIRTUAL_ID_PREFIX, WITH_DEFAULTS, addNormalScript, checkInvalidScopeReference, createFilter, detectVueVersion, getFileCodeAndLang, importHelperFn, isStaticExpression, isStaticObjectKey, parseSFC, removeMacroImport, resolveObjectExpression }; |
@@ -150,16 +150,2 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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/index.ts | ||
function getTransformResult(s, id) { | ||
if (_optionalChain([s, 'optionalAccess', _8 => _8.hasChanged, 'call', _9 => _9()])) { | ||
return { | ||
code: s.toString(), | ||
get map() { | ||
return s.generateMap({ | ||
source: id, | ||
includeContent: true, | ||
hires: true | ||
}); | ||
} | ||
}; | ||
} | ||
} | ||
function createFilter(options) { | ||
@@ -179,4 +165,4 @@ return _pluginutils.createFilter.call(void 0, options.include, options.exclude); | ||
const { descriptor, errors } = sfc; | ||
const scriptLang = _optionalChain([sfc, 'access', _10 => _10.descriptor, 'access', _11 => _11.script, 'optionalAccess', _12 => _12.lang]); | ||
const scriptSetupLang = _optionalChain([sfc, 'access', _13 => _13.descriptor, 'access', _14 => _14.scriptSetup, 'optionalAccess', _15 => _15.lang]); | ||
const scriptLang = _optionalChain([sfc, 'access', _8 => _8.descriptor, 'access', _9 => _9.script, 'optionalAccess', _10 => _10.lang]); | ||
const scriptSetupLang = _optionalChain([sfc, 'access', _11 => _11.descriptor, 'access', _12 => _12.scriptSetup, 'optionalAccess', _13 => _13.lang]); | ||
if (sfc.descriptor.script && sfc.descriptor.scriptSetup && (scriptLang || "js") !== (scriptSetupLang || "js")) { | ||
@@ -193,3 +179,3 @@ throw new Error( | ||
errors, | ||
offset: _nullishCoalesce(_optionalChain([descriptor, 'access', _16 => _16.scriptSetup, 'optionalAccess', _17 => _17.loc, 'access', _18 => _18.start, 'access', _19 => _19.offset]), () => ( 0)), | ||
offset: _nullishCoalesce(_optionalChain([descriptor, 'access', _14 => _14.scriptSetup, 'optionalAccess', _15 => _15.loc, 'access', _16 => _16.start, 'access', _17 => _17.offset]), () => ( 0)), | ||
getSetupAst() { | ||
@@ -219,3 +205,3 @@ if (!descriptor.scriptSetup) | ||
const sfc = parseSFC(code, id); | ||
const scriptCode = _nullishCoalesce(_optionalChain([sfc, 'access', _20 => _20.script, 'optionalAccess', _21 => _21.content]), () => ( "")); | ||
const scriptCode = _nullishCoalesce(_optionalChain([sfc, 'access', _18 => _18.script, 'optionalAccess', _19 => _19.content]), () => ( "")); | ||
return { | ||
@@ -246,3 +232,3 @@ code: sfc.scriptSetup ? `${scriptCode} | ||
function removeMacroImport(node, s, offset) { | ||
if (node.type === "ImportDeclaration" && _optionalChain([node, 'access', _22 => _22.attributes, 'optionalAccess', _23 => _23.some, 'call', _24 => _24( | ||
if (node.type === "ImportDeclaration" && _optionalChain([node, 'access', _20 => _20.attributes, 'optionalAccess', _21 => _21.some, 'call', _22 => _22( | ||
(attr) => _astkit.resolveString.call(void 0, attr.key) === "type" && attr.value.value === "macro" | ||
@@ -289,3 +275,2 @@ )])) { | ||
exports.DEFINE_EMIT = DEFINE_EMIT; exports.DEFINE_EMITS = DEFINE_EMITS; exports.DEFINE_MODELS = DEFINE_MODELS; exports.DEFINE_MODELS_DOLLAR = DEFINE_MODELS_DOLLAR; exports.DEFINE_OPTIONS = DEFINE_OPTIONS; exports.DEFINE_PROP = DEFINE_PROP; exports.DEFINE_PROPS = DEFINE_PROPS; exports.DEFINE_PROPS_DOLLAR = DEFINE_PROPS_DOLLAR; exports.DEFINE_PROPS_REFS = DEFINE_PROPS_REFS; exports.DEFINE_RENDER = DEFINE_RENDER; exports.DEFINE_SETUP_COMPONENT = DEFINE_SETUP_COMPONENT; exports.DEFINE_SLOTS = DEFINE_SLOTS; exports.HELPER_PREFIX = HELPER_PREFIX; exports.REGEX_NODE_MODULES = REGEX_NODE_MODULES; exports.REGEX_SETUP_SFC = REGEX_SETUP_SFC; exports.REGEX_SRC_FILE = REGEX_SRC_FILE; exports.REGEX_SUPPORTED_EXT = REGEX_SUPPORTED_EXT; exports.REGEX_VUE_SFC = REGEX_VUE_SFC; exports.REGEX_VUE_SUB = REGEX_VUE_SUB; exports.REPO_ISSUE_URL = REPO_ISSUE_URL; exports.VIRTUAL_ID_PREFIX = VIRTUAL_ID_PREFIX; exports.WITH_DEFAULTS = WITH_DEFAULTS; exports.addNormalScript = addNormalScript; exports.checkInvalidScopeReference = checkInvalidScopeReference; exports.createFilter = createFilter; exports.detectVueVersion = detectVueVersion; exports.getFileCodeAndLang = getFileCodeAndLang; exports.getTransformResult = getTransformResult; exports.importHelperFn = importHelperFn; exports.isStaticExpression = isStaticExpression; exports.isStaticObjectKey = isStaticObjectKey; exports.normalizePath = _pluginutils.normalizePath; exports.parseSFC = parseSFC; exports.removeMacroImport = removeMacroImport; exports.resolveObjectExpression = resolveObjectExpression; | ||
exports.DEFINE_EMIT = DEFINE_EMIT; exports.DEFINE_EMITS = DEFINE_EMITS; exports.DEFINE_MODELS = DEFINE_MODELS; exports.DEFINE_MODELS_DOLLAR = DEFINE_MODELS_DOLLAR; exports.DEFINE_OPTIONS = DEFINE_OPTIONS; exports.DEFINE_PROP = DEFINE_PROP; exports.DEFINE_PROPS = DEFINE_PROPS; exports.DEFINE_PROPS_DOLLAR = DEFINE_PROPS_DOLLAR; exports.DEFINE_PROPS_REFS = DEFINE_PROPS_REFS; exports.DEFINE_RENDER = DEFINE_RENDER; exports.DEFINE_SETUP_COMPONENT = DEFINE_SETUP_COMPONENT; exports.DEFINE_SLOTS = DEFINE_SLOTS; exports.HELPER_PREFIX = HELPER_PREFIX; exports.REGEX_NODE_MODULES = REGEX_NODE_MODULES; exports.REGEX_SETUP_SFC = REGEX_SETUP_SFC; exports.REGEX_SRC_FILE = REGEX_SRC_FILE; exports.REGEX_SUPPORTED_EXT = REGEX_SUPPORTED_EXT; exports.REGEX_VUE_SFC = REGEX_VUE_SFC; exports.REGEX_VUE_SUB = REGEX_VUE_SUB; exports.REPO_ISSUE_URL = REPO_ISSUE_URL; exports.VIRTUAL_ID_PREFIX = VIRTUAL_ID_PREFIX; exports.WITH_DEFAULTS = WITH_DEFAULTS; exports.addNormalScript = addNormalScript; exports.checkInvalidScopeReference = checkInvalidScopeReference; exports.createFilter = createFilter; exports.detectVueVersion = detectVueVersion; exports.getFileCodeAndLang = getFileCodeAndLang; exports.importHelperFn = importHelperFn; exports.isStaticExpression = isStaticExpression; exports.isStaticObjectKey = isStaticObjectKey; exports.normalizePath = _pluginutils.normalizePath; exports.parseSFC = parseSFC; exports.removeMacroImport = removeMacroImport; exports.resolveObjectExpression = resolveObjectExpression; |
{ | ||
"name": "@vue-macros/common", | ||
"version": "1.6.0", | ||
"packageManager": "pnpm@8.6.10", | ||
"version": "1.6.1", | ||
"packageManager": "pnpm@8.6.11", | ||
"description": "common feature from Vue Macros.", | ||
@@ -61,3 +61,3 @@ "keywords": [ | ||
"local-pkg": "^0.4.3", | ||
"magic-string-ast": "^0.2.0" | ||
"magic-string-ast": "^0.3.0" | ||
}, | ||
@@ -64,0 +64,0 @@ "devDependencies": { |
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
41189
799
+ Addedmagic-string-ast@0.3.0(transitive)
- Removedmagic-string-ast@0.2.0(transitive)
Updatedmagic-string-ast@^0.3.0