aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/build
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/build')
-rw-r--r--vendor/twbs/bootstrap/build/.eslintrc.json1
-rw-r--r--vendor/twbs/bootstrap/build/banner.js2
-rw-r--r--vendor/twbs/bootstrap/build/build-plugins.js69
-rw-r--r--vendor/twbs/bootstrap/build/change-version.js11
-rw-r--r--vendor/twbs/bootstrap/build/generate-sri.js8
-rw-r--r--vendor/twbs/bootstrap/build/rollup.config.js26
-rw-r--r--vendor/twbs/bootstrap/build/ship.sh35
-rw-r--r--vendor/twbs/bootstrap/build/svgo.yml3
-rw-r--r--vendor/twbs/bootstrap/build/vnu-jar.js14
-rw-r--r--vendor/twbs/bootstrap/build/zip-examples.js63
10 files changed, 152 insertions, 80 deletions
diff --git a/vendor/twbs/bootstrap/build/.eslintrc.json b/vendor/twbs/bootstrap/build/.eslintrc.json
index 76e7f37b6..e406f9f69 100644
--- a/vendor/twbs/bootstrap/build/.eslintrc.json
+++ b/vendor/twbs/bootstrap/build/.eslintrc.json
@@ -12,7 +12,6 @@
"func-style": "off",
"no-console": "off",
"no-magic-numbers": "off",
- "no-process-env": "off",
"no-process-exit": "off",
"no-sync": "off",
"spaced-comment": "off"
diff --git a/vendor/twbs/bootstrap/build/banner.js b/vendor/twbs/bootstrap/build/banner.js
index 453fc3b6e..df82ff32e 100644
--- a/vendor/twbs/bootstrap/build/banner.js
+++ b/vendor/twbs/bootstrap/build/banner.js
@@ -7,7 +7,7 @@ function getBanner(pluginFilename) {
return `/*!
* Bootstrap${pluginFilename ? ` ${pluginFilename}` : ''} v${pkg.version} (${pkg.homepage})
* Copyright 2011-${year} ${pkg.author}
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/`
}
diff --git a/vendor/twbs/bootstrap/build/build-plugins.js b/vendor/twbs/bootstrap/build/build-plugins.js
index abcbc5e2f..3829bb294 100644
--- a/vendor/twbs/bootstrap/build/build-plugins.js
+++ b/vendor/twbs/bootstrap/build/build-plugins.js
@@ -1,28 +1,26 @@
+#!/usr/bin/env node
+
/*!
* Script to build our plugins to use them separately.
- * Copyright 2019 The Bootstrap Authors
- * Copyright 2019 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * Copyright 2020 The Bootstrap Authors
+ * Copyright 2020 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
'use strict'
-const path = require('path')
-const rollup = require('rollup')
-const babel = require('rollup-plugin-babel')
-const banner = require('./banner.js')
+const path = require('path')
+const rollup = require('rollup')
+const { babel } = require('@rollup/plugin-babel')
+const banner = require('./banner.js')
-const TEST = process.env.NODE_ENV === 'test'
+const TEST = process.env.NODE_ENV === 'test'
const plugins = [
babel({
- exclude: 'node_modules/**', // Only transpile our source code
- externalHelpersWhitelist: [ // Include only required helpers
- 'defineProperties',
- 'createClass',
- 'inheritsLoose',
- 'defineProperty',
- 'objectSpread'
- ]
+ // Only transpile our source code
+ exclude: 'node_modules/**',
+ // Inline the required helpers in each file
+ babelHelpers: 'inline'
})
]
const bsPlugins = {
@@ -41,7 +39,7 @@ const bsPlugins = {
}
const rootPath = TEST ? '../js/coverage/dist/' : '../js/dist/'
-function build(plugin) {
+const build = async (plugin) => {
console.log(`Building ${plugin} plugin...`)
const external = ['jquery', 'popper.js']
@@ -63,23 +61,32 @@ function build(plugin) {
}
const pluginFilename = `${plugin.toLowerCase()}.js`
-
- rollup.rollup({
+ const bundle = await rollup.rollup({
input: bsPlugins[plugin],
plugins,
external
- }).then((bundle) => {
- bundle.write({
- banner: banner(pluginFilename),
- format: 'umd',
- name: plugin,
- sourcemap: true,
- globals,
- file: path.resolve(__dirname, `${rootPath}${pluginFilename}`)
- })
- .then(() => console.log(`Building ${plugin} plugin... Done!`))
- .catch((err) => console.error(`${plugin}: ${err}`))
})
+
+ await bundle.write({
+ banner: banner(pluginFilename),
+ format: 'umd',
+ name: plugin,
+ sourcemap: true,
+ globals,
+ file: path.resolve(__dirname, `${rootPath}${pluginFilename}`)
+ })
+
+ console.log(`Building ${plugin} plugin... Done!`)
+}
+
+const main = async () => {
+ try {
+ await Promise.all(Object.keys(bsPlugins).map((plugin) => build(plugin)))
+ } catch (error) {
+ console.error(error)
+
+ process.exit(1)
+ }
}
-Object.keys(bsPlugins).forEach((plugin) => build(plugin))
+main()
diff --git a/vendor/twbs/bootstrap/build/change-version.js b/vendor/twbs/bootstrap/build/change-version.js
index f1b4f747a..d1131237c 100644
--- a/vendor/twbs/bootstrap/build/change-version.js
+++ b/vendor/twbs/bootstrap/build/change-version.js
@@ -2,9 +2,9 @@
/*!
* Script to update version number references in the project.
- * Copyright 2017-2019 The Bootstrap Authors
- * Copyright 2017-2019 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * Copyright 2017-2020 The Bootstrap Authors
+ * Copyright 2017-2020 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
'use strict'
@@ -17,11 +17,11 @@ sh.config.fatal = true
// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
function regExpQuote(string) {
- return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
+ return string.replace(/[$()*+.?[\\\]^{|}-]/g, '\\$&')
}
function regExpQuoteReplacement(string) {
- return string.replace(/[$]/g, '$$')
+ return string.replace(/\$/g, '$$')
}
const DRY_RUN = false
@@ -83,6 +83,7 @@ function main(args) {
const newVersion = args[1]
const EXCLUDED_DIRS = new Set([
'.git',
+ '_gh_pages',
'node_modules',
'vendor'
])
diff --git a/vendor/twbs/bootstrap/build/generate-sri.js b/vendor/twbs/bootstrap/build/generate-sri.js
index a93f3e538..d340b5378 100644
--- a/vendor/twbs/bootstrap/build/generate-sri.js
+++ b/vendor/twbs/bootstrap/build/generate-sri.js
@@ -5,9 +5,9 @@
* Remember to use the same vendor files as the CDN ones,
* otherwise the hashes won't match!
*
- * Copyright 2017-2019 The Bootstrap Authors
- * Copyright 2017-2019 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * Copyright 2017-2020 The Bootstrap Authors
+ * Copyright 2017-2020 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
'use strict'
@@ -40,7 +40,7 @@ const files = [
configPropertyName: 'js_bundle_hash'
},
{
- file: `site/docs/${pkg.version_short}/assets/js/vendor/jquery-slim.min.js`,
+ file: `site/docs/${pkg.version_short}/assets/js/vendor/jquery.slim.min.js`,
configPropertyName: 'jquery_hash'
},
{
diff --git a/vendor/twbs/bootstrap/build/rollup.config.js b/vendor/twbs/bootstrap/build/rollup.config.js
index e81a07ef5..6294204cd 100644
--- a/vendor/twbs/bootstrap/build/rollup.config.js
+++ b/vendor/twbs/bootstrap/build/rollup.config.js
@@ -1,24 +1,20 @@
'use strict'
-const path = require('path')
-const babel = require('rollup-plugin-babel')
-const resolve = require('rollup-plugin-node-resolve')
-const banner = require('./banner.js')
+const path = require('path')
+const { babel } = require('@rollup/plugin-babel')
+const { nodeResolve } = require('@rollup/plugin-node-resolve')
+const banner = require('./banner.js')
-const BUNDLE = process.env.BUNDLE === 'true'
+const BUNDLE = process.env.BUNDLE === 'true'
-let fileDest = 'bootstrap.js'
+let fileDest = 'bootstrap.js'
const external = ['jquery', 'popper.js']
const plugins = [
babel({
- exclude: 'node_modules/**', // Only transpile our source code
- externalHelpersWhitelist: [ // Include only required helpers
- 'defineProperties',
- 'createClass',
- 'inheritsLoose',
- 'defineProperty',
- 'objectSpread'
- ]
+ // Only transpile our source code
+ exclude: 'node_modules/**',
+ // Include the helpers in the bundle, at most one copy of each
+ babelHelpers: 'bundled'
})
]
const globals = {
@@ -31,7 +27,7 @@ if (BUNDLE) {
// Remove last entry in external array to bundle Popper
external.pop()
delete globals['popper.js']
- plugins.push(resolve())
+ plugins.push(nodeResolve())
}
module.exports = {
diff --git a/vendor/twbs/bootstrap/build/ship.sh b/vendor/twbs/bootstrap/build/ship.sh
index 289284383..f1c5e38e3 100644
--- a/vendor/twbs/bootstrap/build/ship.sh
+++ b/vendor/twbs/bootstrap/build/ship.sh
@@ -1,4 +1,7 @@
#!/usr/bin/env bash
+
+set -e
+
#
# Usage
# ---------------
@@ -18,35 +21,35 @@ end=$'\e[0m'
current_version=$(node -p "require('./package.json').version")
if [[ $# -lt 1 ]]; then
- printf "\n%s⚠️ Shipping aborted. You must specify a version.\n%s" $red $end
+ printf "\n%s⚠️ Shipping aborted. You must specify a version.\n%s" "$red" "$end"
exit 1
fi
# Pulling latest changes, just to be sure
-printf "\n%s=======================================================%s" $magenta $end
-printf "\n%sPulling latest changes...%s" $magenta $end
-printf "\n%s=======================================================\n\n%s" $magenta $end
+printf "\n%s=======================================================%s" "$magenta" "$end"
+printf "\n%sPulling latest changes...%s" "$magenta" "$end"
+printf "\n%s=======================================================\n\n%s" "$magenta" "$end"
git pull origin v4-dev
# Update version number
-printf "\n%s=======================================================%s" $magenta $end
-printf "\n%sUpdating version number...%s" $magenta $end
-printf "\n%s=======================================================\n%s" $magenta $end
+printf "\n%s=======================================================%s" "$magenta" "$end"
+printf "\n%sUpdating version number...%s" "$magenta" "$end"
+printf "\n%s=======================================================\n%s" "$magenta" "$end"
npm run release-version "$current_version" "$1"
# Build release
-printf "\n%s=======================================================%s" $magenta $end
-printf "\n%sBuilding release...%s" $magenta $end
-printf "\n%s=======================================================\n%s" $magenta $end
+printf "\n%s=======================================================%s" "$magenta" "$end"
+printf "\n%sBuilding release...%s" "$magenta" "$end"
+printf "\n%s=======================================================\n%s" "$magenta" "$end"
npm run release
# Copy the contents of the built docs site over to `bs-docs` repo
-printf "\n%s=======================================================%s" $magenta $end
-printf "\n%sCopy it over...%s" $magenta $end
-printf "\n%s=======================================================\n%s" $magenta $end
+printf "\n%s=======================================================%s" "$magenta" "$end"
+printf "\n%sCopy it over...%s" "$magenta" "$end"
+printf "\n%s=======================================================\n%s" "$magenta" "$end"
cp -rf _gh_pages/. ../bs-docs/
printf "\nDone!\n"
-printf "\n%s=======================================================%s" $green $end
-printf "\n%sSuccess, $1 is ready to review and publish.%s" $green $end
-printf "\n%s=======================================================\n\n%s" $green $end
+printf "\n%s=======================================================%s" "$green" "$end"
+printf "\n%sSuccess, $1 is ready to review and publish.%s" "$green" "$end"
+printf "\n%s=======================================================\n\n%s" "$green" "$end"
diff --git a/vendor/twbs/bootstrap/build/svgo.yml b/vendor/twbs/bootstrap/build/svgo.yml
index 047e6947f..1b592f00f 100644
--- a/vendor/twbs/bootstrap/build/svgo.yml
+++ b/vendor/twbs/bootstrap/build/svgo.yml
@@ -35,6 +35,9 @@ plugins:
- minifyStyles: true
- moveElemsAttrsToGroup: true
- moveGroupAttrsToElems: true
+ - removeAttrs:
+ attrs:
+ - "data-name"
- removeComments: true
- removeDesc: true
- removeDoctype: true
diff --git a/vendor/twbs/bootstrap/build/vnu-jar.js b/vendor/twbs/bootstrap/build/vnu-jar.js
index 7d549cb01..f4a4141c1 100644
--- a/vendor/twbs/bootstrap/build/vnu-jar.js
+++ b/vendor/twbs/bootstrap/build/vnu-jar.js
@@ -2,9 +2,9 @@
/*!
* Script to run vnu-jar if Java is available.
- * Copyright 2017-2019 The Bootstrap Authors
- * Copyright 2017-2019 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * Copyright 2017-2020 The Bootstrap Authors
+ * Copyright 2017-2020 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
'use strict'
@@ -18,7 +18,7 @@ childProcess.exec('java -version', (error, stdout, stderr) => {
return
}
- const is32bitJava = !stderr.match(/64-Bit/)
+ const is32bitJava = !/64-Bit/.test(stderr)
// vnu-jar accepts multiple ignores joined with a `|`.
// Also note that the ignores are regular expressions.
@@ -36,9 +36,7 @@ childProcess.exec('java -version', (error, stdout, stderr) => {
'The “time” input type is not supported in all browsers.*',
// IE11 doesn't recognise <main> / give the element an implicit "main" landmark.
// Explicit role="main" is redundant for other modern browsers, but still valid.
- 'The “main” role is unnecessary for element “main”.',
- // Ignore the wrong lanuage code warnings for now; they happen randomly.
- 'This document appears to be written in.*'
+ 'The “main” role is unnecessary for element “main”.'
].join('|')
const args = [
@@ -46,6 +44,8 @@ childProcess.exec('java -version', (error, stdout, stderr) => {
vnu,
'--asciiquotes',
'--skip-non-html',
+ // Ignore the language code warnings
+ '--no-langdetect',
'--Werror',
`--filterpattern "${ignores}"`,
'_gh_pages/',
diff --git a/vendor/twbs/bootstrap/build/zip-examples.js b/vendor/twbs/bootstrap/build/zip-examples.js
new file mode 100644
index 000000000..5d6d31454
--- /dev/null
+++ b/vendor/twbs/bootstrap/build/zip-examples.js
@@ -0,0 +1,63 @@
+#!/usr/bin/env node
+
+/*!
+ * Script to create the built examples zip archive;
+ * requires the `zip` command to be present!
+ * Copyright 2020 The Bootstrap Authors
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
+ */
+
+'use strict'
+
+const path = require('path')
+const sh = require('shelljs')
+
+const {
+ version, version_short: versionShort
+} = require('../package.json')
+
+const folderName = `bootstrap-${version}-examples`
+
+sh.config.fatal = true
+
+if (!sh.test('-d', '_gh_pages')) {
+ throw new Error('The "_gh_pages" folder does not exist, did you forget building the docs?')
+}
+
+// switch to the root dir
+sh.cd(path.join(__dirname, '..'))
+
+// remove any previously created folder with the same name
+sh.rm('-rf', folderName)
+// create any folders so that `cp` works
+sh.mkdir('-p', folderName)
+sh.mkdir('-p', `${folderName}/assets/brand/`)
+
+sh.cp('-Rf', `_gh_pages/docs/${versionShort}/examples/*`, folderName)
+sh.cp('-Rf', `_gh_pages/docs/${versionShort}/dist/`, `${folderName}/assets/`)
+// also copy the two brand images we use in the examples
+sh.cp('-f', [
+ `_gh_pages/docs/${versionShort}/assets/brand/bootstrap-outline.svg`,
+ `_gh_pages/docs/${versionShort}/assets/brand/bootstrap-solid.svg`
+], `${folderName}/assets/brand/`)
+sh.rm(`${folderName}/index.html`)
+
+// get all examples' HTML files
+sh.find(`${folderName}/**/*.html`).forEach((file) => {
+ const fileContents = sh.cat(file)
+ .toString()
+ .replace(new RegExp(`"/docs/${versionShort}/`, 'g'), '"../')
+ .replace(/"..\/dist\//g, '"../assets/dist/')
+ .replace(/(<link href="\.\.\/.*) integrity=".*>/g, '$1>')
+ .replace(/(<script src="\.\.\/.*) integrity=".*>/g, '$1></script>')
+ .replace(/( +)<!-- favicons(.|\n)+<style>/i, ' <style>')
+ new sh.ShellString(fileContents).to(file)
+})
+
+// create the zip file
+sh.exec(`zip -r9 "${folderName}.zip" "${folderName}"`, {
+ fatal: true
+})
+
+// remove the folder we created
+sh.rm('-rf', folderName)