"build-dts": "tsc -p tsconfig.build.json --noCheck && rollup -c rollup.dts.config.js",
"clean": "rimraf --glob packages/*/dist temp .eslintcache",
"size": "run-s \"size-*\" && node scripts/usage-size.js",
- "size-global": "node scripts/build.js vue vue-vapor runtime-dom runtime-vapor compiler-dom compiler-vapor -f global -p --size",
+ "size-global": "node scripts/build.js vue vue-vapor runtime-dom runtime-vapor compiler-dom -f global -p --size",
"size-esm-runtime": "node scripts/build.js vue vue-vapor -f esm-bundler-runtime",
"size-esm": "node scripts/build.js runtime-shared runtime-dom runtime-vapor runtime-core reactivity shared -f esm-bundler",
"check": "tsc --incremental --noEmit",
+++ /dev/null
-'use strict'
-
-if (process.env.NODE_ENV === 'production') {
- module.exports = require('./dist/compiler-vapor.cjs.prod.js')
-} else {
- module.exports = require('./dist/compiler-vapor.cjs.js')
-}
"main": "index.js",
"module": "dist/compiler-vapor.esm-bundler.js",
"types": "dist/compiler-vapor.d.ts",
- "unpkg": "dist/compiler-vapor.global.js",
- "jsdelivr": "dist/compiler-vapor.global.js",
"files": [
- "index.js",
"dist"
],
"sideEffects": false,
+ "exports": {
+ ".": {
+ "types": "./dist/compiler-vapor.d.ts",
+ "node": "./dist/compiler-vapor.cjs.js",
+ "module": "./dist/compiler-vapor.esm-browser.js",
+ "import": "./dist/compiler-vapor.esm-browser.js",
+ "require": "./dist/compiler-vapor.cjs.js"
+ },
+ "./*": "./*"
+ },
"buildOptions": {
"name": "VueCompilerVapor",
- "compat": true,
"formats": [
- "esm-bundler",
- "esm-browser",
"cjs",
- "global"
- ]
+ "esm-browser"
+ ],
+ "prod": false,
+ "enableNonBrowserBranches": true
},
"repository": {
"type": "git",
): VaporCodegenResult {
const onError = options.onError || defaultOnError
const isModuleMode = options.mode === 'module'
- /* istanbul ignore if */
- if (__BROWSER__) {
- if (options.prefixIdentifiers === true) {
- onError(createCompilerError(ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED))
- } else if (isModuleMode) {
- onError(createCompilerError(ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED))
- }
- }
-
- const prefixIdentifiers =
- !__BROWSER__ && (options.prefixIdentifiers === true || isModuleMode)
+ const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode
if (options.scopeId && !isModuleMode) {
onError(createCompilerError(ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED))
const [nodeTransforms, directiveTransforms] =
getBaseTransformPreset(prefixIdentifiers)
- if (!__BROWSER__ && options.isTS) {
+ if (options.isTS) {
const { expressionPlugins } = options
if (!expressionPlugins || !expressionPlugins.includes('typescript')) {
resolvedOptions.expressionPlugins = [
return createCompilerError(
code,
loc,
- __DEV__ || !__BROWSER__ ? VaporErrorMessages : undefined,
+ VaporErrorMessages,
) as VaporCompilerError
}
}
if (
- __BROWSER__ ||
!prefixIdentifiers ||
!node.content.trim() ||
// there was a parsing error
} = context
let map: CodegenSourceMapGenerator | undefined
- if (!__BROWSER__ && sourceMap) {
+ if (sourceMap) {
// lazy require source-map implementation, only in non-browser builds
map = new SourceMapGenerator() as unknown as CodegenSourceMapGenerator
map.setSourceContent(filename, context.ir.source)
let [code, newlineIndex = NewlineType.None, loc, name] = frag
codegen += code
- if (!__BROWSER__ && map) {
+ if (map) {
if (loc) addMapping(loc.start, name)
if (newlineIndex === NewlineType.Unknown) {
// multiple newlines, full iteration
) {
let asset = true
- if (!__BROWSER__) {
- const fromSetup = resolveSetupReference(tag, context)
- if (fromSetup) {
- tag = fromSetup
+ const fromSetup = resolveSetupReference(tag, context)
+ if (fromSetup) {
+ tag = fromSetup
+ asset = false
+ }
+
+ const dotIndex = tag.indexOf('.')
+ if (dotIndex > 0) {
+ const ns = resolveSetupReference(tag.slice(0, dotIndex), context)
+ if (ns) {
+ tag = ns + tag.slice(dotIndex)
asset = false
}
- const dotIndex = tag.indexOf('.')
- if (dotIndex > 0) {
- const ns = resolveSetupReference(tag.slice(0, dotIndex), context)
- if (ns) {
- tag = ns + tag.slice(dotIndex)
- asset = false
- }
- }
}
+
if (asset) {
context.component.add(tag)
}
}
if (!isBuiltInDirective(name)) {
- const fromSetup =
- !__BROWSER__ && resolveSetupReference(`v-${name}`, context)
+ const fromSetup = resolveSetupReference(`v-${name}`, context)
if (fromSetup) {
name = fromSetup
} else {
if (!exp) exp = normalizeBindShorthand(arg, context)
if (!exp.content.trim()) {
- if (!__BROWSER__) {
- // #10280 only error against empty expression in non-browser build
- // because :foo in in-DOM templates will be parsed into :foo="" by the
- // browser
- context.options.onError(
- createCompilerError(ErrorCodes.X_V_BIND_NO_EXPRESSION, loc),
- )
- }
+ context.options.onError(
+ createCompilerError(ErrorCodes.X_V_BIND_NO_EXPRESSION, loc),
+ )
exp = createSimpleExpression('', true, loc)
}
const expString = exp.content
const maybeRef =
- !__BROWSER__ &&
context.options.inline &&
(bindingType === BindingTypes.SETUP_LET ||
bindingType === BindingTypes.SETUP_REF ||
export function getLiteralExpressionValue(
exp: SimpleExpressionNode,
): number | string | boolean | null {
- if (!__BROWSER__ && exp.ast) {
+ if (exp.ast) {
if (
['StringLiteral', 'NumericLiteral', 'BigIntLiteral'].includes(
exp.ast.type,