-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
84 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const nodeResolve = require('rollup-plugin-node-resolve') | ||
const commonjs = require('rollup-plugin-commonjs') | ||
const istanbul = require('substance-bundler/extensions/rollup/rollup-plugin-istanbul') | ||
|
||
// This is now used for browser tests and coverage | ||
module.exports = function (options = {}) { | ||
const config = { | ||
input: 'index.es.js', | ||
output: { | ||
file: 'tmp/substance.js', | ||
format: 'umd', | ||
name: 'substance', | ||
sourcemap: true, | ||
sourcemapRoot: __dirname, | ||
sourcemapPrefix: 'substance' | ||
}, | ||
plugins: [ | ||
nodeResolve(), | ||
commonjs({ | ||
include: [ | ||
'node_modules/boolbase/**/*', | ||
'node_modules/css-what/**/*', | ||
'node_modules/domelementtype/**/*', | ||
'node_modules/nth-check/**/*' | ||
] | ||
}) | ||
] | ||
} | ||
if (options.coverage) { | ||
config.output.file = 'tmp/substance.istanbul.js' | ||
config.plugins.push(istanbul({ | ||
include: [ | ||
'dom/*.js', | ||
'model/*.js', | ||
'editor/*.js', | ||
'util/*.js' | ||
] | ||
})) | ||
} | ||
return config | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,16 @@ | ||
module.exports = function (options = {}) { | ||
let target = options.target || 'all' | ||
let config = [] | ||
if (target === 'browser' || target === 'all') { | ||
config.push({ | ||
input: 'test/index.js', | ||
output: { | ||
file: 'tmp/tests.js', | ||
format: 'umd', | ||
name: 'tests', | ||
globals: { | ||
'substance': 'window.substance', | ||
'substance-test': 'window.substanceTest' | ||
}, | ||
sourcemap: true | ||
}, | ||
external: [ 'substance', 'substance-test' ] | ||
}) | ||
} | ||
if (target === 'node' || target === 'all') { | ||
config.push({ | ||
input: 'test/index.js', | ||
output: { | ||
file: 'tmp/tests.cjs.js', | ||
format: 'cjs', | ||
sourcemap: true | ||
}, | ||
external: ['substance', 'substance-test'], | ||
plugins: [ | ||
_patchNodeTest() | ||
] | ||
}) | ||
} | ||
return config | ||
} | ||
|
||
function _patchNodeTest () { | ||
return { | ||
name: 'patch-node-test', | ||
generateBundle (options, bundle, isWrite) { | ||
let output = bundle['tests.cjs.js'] | ||
output.code = output.code.replace("'substance'", "'../dist/substance.cjs.js'") | ||
} | ||
input: 'test/index.js', | ||
output: { | ||
file: 'tmp/tests.js', | ||
format: 'umd', | ||
name: 'tests', | ||
globals: { | ||
'substance': 'window.substance', | ||
'substance-test': 'window.substanceTest' | ||
}, | ||
sourcemap: true | ||
}, | ||
external: [ 'substance', 'substance-test' ] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = function (_module) { | ||
const path = require('path') | ||
// create the ESM loader first | ||
let _require = require('esm')(_module) | ||
// and let 'module-alias' register on top of the ESM loaded | ||
const moduleAlias = _require('module-alias') | ||
const substanceEntryPoint = path.join(__dirname, '..', 'index.es.js') | ||
moduleAlias.addAlias('substance', substanceEntryPoint) | ||
// register the alias module loaded | ||
moduleAlias() | ||
return _require | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const _require = require('./_initLoader')(module) | ||
_require('./index.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters