Skip to content

Commit be3f395

Browse files
committed
simplify a bit further
1 parent 101e0b4 commit be3f395

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

tools/build_browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ async function buildCore(name, languages, options) {
201201
const header = buildHeader();
202202
let relativePath = "";
203203
const input = {
204-
...(options.format === "es" ? config.rollup.node.input : config.rollup.browser_iife.input),
204+
...config.rollup.core.input,
205205
input: `src/stub.js`
206206
};
207207
input.plugins = [

tools/build_config.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ module.exports = {
99
level: 2
1010
},
1111
rollup: {
12-
node: {
13-
output: { format: "cjs", strict: false, exports: "auto" },
12+
core: {
1413
input: {
1514
plugins: [
1615
cjsPlugin(),
1716
jsonPlugin(),
1817
nodeResolve(),
18+
// TODO: remove with version 12
1919
{
2020
transform: (x) => {
2121
if (/var module/.exec(x)) {
@@ -27,6 +27,9 @@ module.exports = {
2727
]
2828
}
2929
},
30+
node: {
31+
output: { format: "cjs", strict: false, exports: "auto" }
32+
},
3033
browser_iife: {
3134
input: {
3235
plugins: [
@@ -41,15 +44,6 @@ module.exports = {
4144
footer: "if (typeof exports === 'object' && typeof module !== 'undefined') { module.exports = hljs; }",
4245
interop: false
4346
}
44-
},
45-
browser: {
46-
input: {
47-
plugins: []
48-
},
49-
output: {
50-
format: "es",
51-
interop: false
52-
}
5347
}
5448
},
5549
terser: {

tools/build_node.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async function buildNodeLanguage(language, options) {
4545
const ES_STUB = `${EMIT}
4646
import lang from './%%%%.js';
4747
export default lang;`;
48-
const input = { ...config.rollup.node.input, input: language.path };
48+
const input = { ...config.rollup.core.input, input: language.path };
4949
const output = { ...config.rollup.node.output, file: `${process.env.BUILD_DIR}/lib/languages/${language.name}.js` };
5050
await rollupWrite(input, output);
5151
await fs.writeFile(`${process.env.BUILD_DIR}/lib/languages/${language.name}.js.js`,
@@ -63,7 +63,7 @@ async function buildNodeLanguage(language, options) {
6363
const EXCLUDE = ["join"];
6464

6565
async function buildESMUtils() {
66-
const input = { ...config.rollup.node.input, input: `src/lib/regex.js` };
66+
const input = { ...config.rollup.core.input, input: `src/lib/regex.js` };
6767
input.plugins = [...input.plugins, {
6868
transform: (code) => {
6969
EXCLUDE.forEach((fn) => {
@@ -80,7 +80,7 @@ async function buildESMUtils() {
8080
}
8181

8282
async function buildNodeHighlightJS(options) {
83-
const input = { ...config.rollup.node.input, input: `src/highlight.js` };
83+
const input = { ...config.rollup.core.input, input: `src/highlight.js` };
8484
const output = { ...config.rollup.node.output, file: `${process.env.BUILD_DIR}/lib/core.js` };
8585
await rollupWrite(input, output);
8686
if (options.esm) {

0 commit comments

Comments
 (0)