Skip to content

Commit 89c2806

Browse files
committed
Use esbuild to produce a single file
1 parent a730083 commit 89c2806

File tree

6 files changed

+166
-10
lines changed

6 files changed

+166
-10
lines changed

package-lock.json

Lines changed: 152 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
"bugs": "https://github.com/asciidoctor/asciidoctor-vscode/issues",
1919
"homepage": "https://github.com/asciidoctor/asciidoctor-vscode/blob/master/README.md",
2020
"icon": "images/icon.png",
21+
"main": "./out/extension.js",
2122
"browser": "./dist/browser/extension",
22-
"main": "./dist/src/extension.js",
2323
"engines": {
24-
"vscode": "^1.31.0"
24+
"vscode": "^1.60.0"
2525
},
2626
"categories": [
2727
"Programming Languages"
@@ -466,17 +466,19 @@
466466
]
467467
},
468468
"scripts": {
469+
"vscode:prepublish": "npm run build-ext -- --minify",
469470
"copy-assets": "cp node_modules/@highlightjs/cdn-assets/highlight.min.js media/highlightjs && cp -r node_modules/@highlightjs/cdn-assets/languages media/highlightjs && cp -r node_modules/@highlightjs/cdn-assets/styles media/highlightjs",
470471
"dev": "npm run build",
471472
"build": "npm run copy-assets && npm run build-ext && npm run build-preview",
472473
"build-web": "webpack --config extension-browser.webpack.config --mode none",
473474
"build-preview": "webpack --config extension-preview.webpack.config --mode production",
474-
"build-ext": "tsc -p ./",
475+
"build-ext": "esbuild ./src/extension.ts --bundle --outfile=out/extension.js --external:vscode --format=cjs --platform=node",
476+
"build-ext:watch": "npm run build-ext -- --sourcemap --watch",
475477
"package": "npm run build && npm run build-web && vsce package",
476478
"deploy": "vsce publish -p",
477479
"lint": "eslint 'src/**/*.ts' 'preview-src/**/*.ts' --format unix",
478480
"lint:fix": "npm run lint -- --fix",
479-
"pretest": "npm run build",
481+
"pretest": "tsc -p ./ && npm run build",
480482
"test": "node ./dist/src/test/runTest.js"
481483
},
482484
"devDependencies": {
@@ -488,6 +490,7 @@
488490
"@typescript-eslint/eslint-plugin": "^4.31.1",
489491
"@typescript-eslint/parser": "^4.31.1",
490492
"copy-webpack-plugin": "^9.0.1",
493+
"esbuild": "^0.14.17",
491494
"eslint": "^7.32.0",
492495
"eslint-plugin-import": "^2.20.2",
493496
"eslint-plugin-node": "^11.1.0",

src/commands/exportAsPDF.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as os from 'os'
33
import * as fs from 'fs'
44
import * as path from 'path'
55
import { exec, spawn } from 'child_process'
6-
import { uuidv4 } from 'uuid'
6+
import { v4 as uuidv4 } from 'uuid'
77
import * as zlib from 'zlib'
88
import { AsciidocEngine } from '../asciidocEngine'
99
import { Command } from '../commandManager'

src/image-paste.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as path from 'path'
22
import * as vscode from 'vscode'
33
import { spawn } from 'child_process'
4-
import * as moment from 'moment'
4+
import moment from 'moment'
55
import * as fs from 'fs'
66

77
import { AsciidocParser } from './asciidocParser'

src/test/suite/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as path from 'path'
2-
import * as Mocha from 'mocha'
3-
import * as glob from 'glob'
1+
import path from 'path'
2+
import Mocha from 'mocha'
3+
import glob from 'glob'
44

55
export function run (): Promise<void> {
66
// Create the mocha test

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"compilerOptions": {
3+
"esModuleInterop": true,
34
"resolveJsonModule": true,
45
"module": "commonjs",
5-
"target": "es6",
6+
"target": "es2020",
67
"outDir": "dist",
78
"lib": [
89
"es6",

0 commit comments

Comments
 (0)