Skip to content

Commit 1dc5763

Browse files
committed
fix bundle
1 parent 763807d commit 1dc5763

File tree

8 files changed

+35
-16
lines changed

8 files changed

+35
-16
lines changed

extensions/vscode-vue-language-features/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "vue-language-features",
55
"publisher": "znck",
66
"displayName": "VueDX",
7-
"version": "0.10.3",
7+
"version": "0.10.4",
88
"description": "Advanced TypeScript/JavaScript support for Vue",
99
"icon": "logo.png",
1010
"main": "dist/index.js",

extensions/vscode-vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "vue",
55
"publisher": "znck",
66
"displayName": "Vue",
7-
"version": "0.10.3",
7+
"version": "0.10.4",
88
"description": "Syntax Highlight",
99
"icon": "logo.png",
1010
"main": "dist/index.js",

packages/monorepo-tools/src/rollup-plugin-esbuild.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import type {
2323
export function esbuild(
2424
config: boolean | BuildOptions,
2525
getExternal: () => ExternalOption | undefined,
26+
minify: boolean = process.env['CI'] != null,
2627
): Plugin {
2728
let format: 'iife' | 'cjs' | 'esm' = 'esm'
2829
let outputOptions!: OutputOptions
@@ -170,6 +171,11 @@ export function esbuild(
170171
outfile: fileName,
171172
treeShaking: true,
172173
resolveExtensions: ['.mjs', '.js', '.cjs'],
174+
minify: minify,
175+
minifyIdentifiers: minify,
176+
minifyWhitespace: minify,
177+
minifySyntax: minify,
178+
legalComments: 'none',
173179
...defaults,
174180
sourcemap: 'external',
175181
entryPoints: [fileName],

packages/monorepo-tools/src/rollup.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,14 @@ export function generateRollupOptions(
134134
...packageJson.publishConfig,
135135
})
136136
.map(([key, value]) => ({ key, value }))
137-
.filter((item): item is {
138-
key: 'main' | 'module' | 'types' | 'unpkg'
139-
value: string
140-
} => /^(main|module|unpkg|types)$/.test(item.key))
137+
.filter(
138+
(
139+
item,
140+
): item is {
141+
key: 'main' | 'module' | 'types' | 'unpkg'
142+
value: string
143+
} => /^(main|module|unpkg|types)$/.test(item.key),
144+
)
141145
.map<ExtendedOutputOptions>(({ key: type, value: file }) => ({
142146
file: file,
143147
format:

packages/projectconfig/src/project/FilesystemHost.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Path from 'path'
1+
import * as Path from 'path'
22
import { toPosixPath } from '@vuedx/shared'
33

44
export interface FileWatcher {

packages/projectconfig/src/project/VueProject.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import {
1212
} from './FilesystemHost'
1313
import { resolveComponents } from './resolveComponents'
1414
import { resolveDirectives } from './resolveDirectives'
15-
import JSON5 from 'json5'
16-
import Path from 'path'
15+
import * as JSON5 from 'json5'
16+
import * as Path from 'path'
1717

1818
export class VueProject {
1919
static create(fs: FilesystemHost, rootDir: string): VueProject {

packages/transforms/src/index.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import * as T from '@babel/types'
2-
import template from '@babel/template'
3-
import generator, { GeneratorResult, GeneratorOptions } from '@babel/generator'
2+
import * as template from '@babel/template'
3+
import {
4+
GeneratorResult,
5+
GeneratorOptions,
6+
CodeGenerator,
7+
} from '@babel/generator'
48
import { parse, ParserOptions } from '@babel/parser'
59
import MagicString from 'magic-string'
610

@@ -69,10 +73,10 @@ export function toCode(
6973
),
7074
)
7175

72-
const result = generator(statement as any, {
76+
const result = new CodeGenerator(statement as any, {
7377
comments: true,
7478
...options,
75-
})
79+
}).generate()
7680

7781
if (sourceText == null) return result
7882

@@ -218,7 +222,7 @@ export const createExportDeclarationForComponent = memoizeByFirstArg(
218222
return T.exportNamedDeclaration(statement)
219223

220224
function createDeclarationForScriptSetup(): any {
221-
const createExpr = template(
225+
const createExpr = template.statement(
222226
`const ${config.exportName} = ${config.defineComponent}(
223227
%%props%%,
224228
%%emits%%,
@@ -249,7 +253,7 @@ export const createExportDeclarationForComponent = memoizeByFirstArg(
249253
return createExpr({ props, emits, bindings, extra })
250254
}
251255
function createDeclarationForScript(): any {
252-
const createExpr = template(
256+
const createExpr = template.statement(
253257
`const ${config.exportName} = ${config.defineComponent}(%%options%%)`,
254258
)
255259

@@ -485,7 +489,9 @@ function createExportDeclarationFor(
485489
...options,
486490
}
487491

488-
const createExpr = template(`const ${config.exportName} = %%value%%;`)
492+
const createExpr = template.statement(
493+
`const ${config.exportName} = %%value%%;`,
494+
)
489495
const declaration = createExpr({
490496
value: getExpressionOrReference(findTargetExpression(), config),
491497
})

packages/vue-virtual-textdocument/src/BlockTransformer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ export const builtins: Record<'script' | 'template', BlockTransformer> = {
172172
'export const __VueDX_directives = {};',
173173
'export const __VueDX_expose = {};',
174174
'export const __VueDX_DefineComponent = VueDX.internal.defineComponent({});',
175+
`/* Error: ${(error as Error).message} ${
176+
(error as Error).stack ?? ''
177+
} */`,
175178
annotations.diagnosticsIgnore.end,
176179
)),
177180
errors: [],

0 commit comments

Comments
 (0)