mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 04:40:39 -07:00
fix: target ES6 for ESM bundles, fixes #526
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@
|
|||||||
"@typescript-eslint/no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false }]
|
"@typescript-eslint/no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false }]
|
||||||
},
|
},
|
||||||
"overrides": [{
|
"overrides": [{
|
||||||
"files": ["**/*.js", "*.js"],
|
"files": ["**/*.js", "**/*.mjs"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/no-var-requires": "off"
|
"@typescript-eslint/no-var-requires": "off"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"types": "dist/liquid.d.ts",
|
"types": "dist/liquid.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint \"**/*.ts\" .",
|
"lint": "eslint \"**/*.mjs\" \"**/*.ts\" .",
|
||||||
"check": "npm run build && npm test && npm run lint && npm run perf:diff",
|
"check": "npm run build && npm test && npm run lint && npm run perf:diff",
|
||||||
"test": "nyc mocha \"test/**/*.ts\"",
|
"test": "nyc mocha \"test/**/*.ts\"",
|
||||||
"test:e2e": "mocha \"test/e2e/**/*.ts\"",
|
"test:e2e": "mocha \"test/e2e/**/*.ts\"",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"perf:engines": "cd benchmark && npm run engines",
|
"perf:engines": "cd benchmark && npm run engines",
|
||||||
"postversion": "npm run build:dist",
|
"postversion": "npm run build:dist",
|
||||||
"build": "npm run build:dist && npm run build:docs",
|
"build": "npm run build:dist && npm run build:docs",
|
||||||
"build:dist": "rollup -c rollup.config.ts",
|
"build:dist": "rollup -c rollup.config.mjs",
|
||||||
"build:docs": "bin/build-docs.sh"
|
"build:docs": "bin/build-docs.sh"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { uglify } from 'rollup-plugin-uglify'
|
import { uglify } from 'rollup-plugin-uglify'
|
||||||
import pkg from './package.json'
|
|
||||||
import typescript from 'rollup-plugin-typescript2'
|
import typescript from 'rollup-plugin-typescript2'
|
||||||
import replace from 'rollup-plugin-replace'
|
import replace from 'rollup-plugin-replace'
|
||||||
import versionInjector from 'rollup-plugin-version-injector'
|
import versionInjector from 'rollup-plugin-version-injector'
|
||||||
|
import { createRequire } from 'module'
|
||||||
|
|
||||||
|
const pkg = createRequire(import.meta.url)('./package.json')
|
||||||
const version = process.env.VERSION || pkg.version
|
const version = process.env.VERSION || pkg.version
|
||||||
const sourcemap = true
|
const sourcemap = true
|
||||||
const banner = `/*
|
const banner = `/*
|
||||||
@@ -14,16 +15,16 @@ const banner = `/*
|
|||||||
const treeshake = {
|
const treeshake = {
|
||||||
propertyReadSideEffects: false
|
propertyReadSideEffects: false
|
||||||
}
|
}
|
||||||
const tsconfig = {
|
const tsconfig = (target) => ({
|
||||||
tsconfigOverride: {
|
tsconfigOverride: {
|
||||||
include: [ 'src' ],
|
include: [ 'src' ],
|
||||||
exclude: [ 'test', 'benchmark' ],
|
exclude: [ 'test', 'benchmark' ],
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
target: 'es5',
|
target,
|
||||||
module: 'ES2015'
|
module: 'ES2015'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
const versionInjection = versionInjector({
|
const versionInjection = versionInjector({
|
||||||
injectInComments: false,
|
injectInComments: false,
|
||||||
injectInTags: {
|
injectInTags: {
|
||||||
@@ -60,7 +61,7 @@ const nodeCjs = {
|
|||||||
banner
|
banner
|
||||||
}],
|
}],
|
||||||
external: ['path', 'fs'],
|
external: ['path', 'fs'],
|
||||||
plugins: [versionInjection, typescript(tsconfig)],
|
plugins: [versionInjection, typescript(tsconfig('es5'))],
|
||||||
treeshake,
|
treeshake,
|
||||||
input
|
input
|
||||||
}
|
}
|
||||||
@@ -75,7 +76,7 @@ const nodeEsm = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
versionInjection,
|
versionInjection,
|
||||||
replace(esmRequire),
|
replace(esmRequire),
|
||||||
typescript(tsconfig)
|
typescript(tsconfig('es6'))
|
||||||
],
|
],
|
||||||
treeshake,
|
treeshake,
|
||||||
input
|
input
|
||||||
@@ -92,7 +93,7 @@ const browserEsm = {
|
|||||||
versionInjection,
|
versionInjection,
|
||||||
replace(browserFS),
|
replace(browserFS),
|
||||||
replace(browserStream),
|
replace(browserStream),
|
||||||
typescript(tsconfig)
|
typescript(tsconfig('es6'))
|
||||||
],
|
],
|
||||||
treeshake,
|
treeshake,
|
||||||
input
|
input
|
||||||
@@ -110,7 +111,7 @@ const browserUmd = {
|
|||||||
versionInjection,
|
versionInjection,
|
||||||
replace(browserFS),
|
replace(browserFS),
|
||||||
replace(browserStream),
|
replace(browserStream),
|
||||||
typescript(tsconfig)
|
typescript(tsconfig('es5'))
|
||||||
],
|
],
|
||||||
treeshake,
|
treeshake,
|
||||||
input
|
input
|
||||||
@@ -128,7 +129,7 @@ const browserMin = {
|
|||||||
versionInjection,
|
versionInjection,
|
||||||
replace(browserFS),
|
replace(browserFS),
|
||||||
replace(browserStream),
|
replace(browserStream),
|
||||||
typescript(tsconfig),
|
typescript(tsconfig('es5')),
|
||||||
uglify()
|
uglify()
|
||||||
],
|
],
|
||||||
treeshake,
|
treeshake,
|
||||||
Reference in New Issue
Block a user