@morev/bem-vue 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,6 +5,7 @@ import traverseModule from "@babel/traverse";
|
|
|
5
5
|
import { NodeTypes, createCompoundExpression, createSimpleExpression } from "@vue/compiler-core";
|
|
6
6
|
import { baseParse } from "@vue/compiler-dom";
|
|
7
7
|
import MagicString from "magic-string";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
8
9
|
//#region src/diagnostics.ts
|
|
9
10
|
/**
|
|
10
11
|
* Compile-time error tied to a Vue template or script location.
|
|
@@ -54,10 +55,12 @@ const serializeFactoryOptions = (factoryOptions) => {
|
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
57
|
const createVirtualModule = (options) => {
|
|
57
|
-
|
|
58
|
+
const factoryArgument = options.factoryOptions === void 0 ? "" : serializeFactoryOptions(options.factoryOptions);
|
|
59
|
+
const classnamesPath = fileURLToPath(import.meta.resolve("@morev/bem-classnames")).replaceAll("\\", "/");
|
|
60
|
+
return `import { bemClassnames } from ${JSON.stringify(classnamesPath)};
|
|
58
61
|
import { getCurrentInstance } from 'vue';
|
|
59
62
|
|
|
60
|
-
const __bemVueFactory = bemClassnames(${
|
|
63
|
+
const __bemVueFactory = bemClassnames(${factoryArgument});
|
|
61
64
|
const __bemVueCache = new Map();
|
|
62
65
|
|
|
63
66
|
const __bemVueGetBlock = (name, fallback) => {
|
|
@@ -346,12 +349,11 @@ const createTemplateTransform = (root, metadata, metadataByToken, resolveBlockNa
|
|
|
346
349
|
if (!fallback) throw new BemVueTransformError(filename, directiveLocation, "resolveBlockName() returned an empty block name.");
|
|
347
350
|
const isVapor = componentMetadata?.vapor ?? false;
|
|
348
351
|
const isVaporCompiler = isVapor && "options" in context;
|
|
349
|
-
const compilerContextKey = context.root;
|
|
350
352
|
const vaporHelper = isVapor ? vaporHelperDirective : void 0;
|
|
351
353
|
const vaporBlockDirective = isVapor ? getInternalDirective(templateNode, VAPOR_BLOCK_DIRECTIVE) : void 0;
|
|
352
|
-
const helper = isVapor ? componentMetadata?.helperIdentifier && (isVaporCompiler ? componentMetadata.helperIdentifier : `$setup.${componentMetadata.helperIdentifier}`) : helperIdentifiers.get(
|
|
354
|
+
const helper = isVapor ? componentMetadata?.helperIdentifier && (isVaporCompiler ? componentMetadata.helperIdentifier : `$setup.${componentMetadata.helperIdentifier}`) : helperIdentifiers.get(context.imports) ?? getCompilerHelperIdentifier(context);
|
|
353
355
|
if (!helper) throw new BemVueTransformError(filename, directiveLocation, "Vapor helper metadata is unavailable. Run transformSfc() before compiling the template.");
|
|
354
|
-
if (
|
|
356
|
+
if (!isVapor) helperIdentifiers.set(context.imports, helper);
|
|
355
357
|
if (vaporHelper) templateNode.props.splice(templateNode.props.indexOf(vaporHelper), 1);
|
|
356
358
|
if (vaporBlockDirective) templateNode.props.splice(templateNode.props.indexOf(vaporBlockDirective), 1);
|
|
357
359
|
const directiveIndex = templateNode.props.indexOf(directive);
|
package/dist/compiler.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createBemVueCompiler } from "./compiler-
|
|
1
|
+
import { t as createBemVueCompiler } from "./compiler-DzGfkfml.js";
|
|
2
2
|
export { createBemVueCompiler };
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createBemVueCompiler } from "./compiler-
|
|
1
|
+
import { t as createBemVueCompiler } from "./compiler-DzGfkfml.js";
|
|
2
2
|
import { t as bemVueUnplugin } from "./unplugin-DAY_Kbnw.js";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { parse } from "@vue/compiler-sfc";
|
package/dist/webpack.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as VIRTUAL_MODULE_ID, r as WEBPACK_VIRTUAL_MODULE_ID, t as createBemVueCompiler } from "./compiler-
|
|
1
|
+
import { n as VIRTUAL_MODULE_ID, r as WEBPACK_VIRTUAL_MODULE_ID, t as createBemVueCompiler } from "./compiler-DzGfkfml.js";
|
|
2
2
|
import { t as bemVueUnplugin } from "./unplugin-DAY_Kbnw.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { normalize, resolve } from "node:path";
|