aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/preact/config
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/preact/config')
-rw-r--r--thirdparty/preact/config/codemod-const.js39
-rw-r--r--thirdparty/preact/config/codemod-strip-tdz.js56
-rw-r--r--thirdparty/preact/config/eslint-config.js66
-rw-r--r--thirdparty/preact/config/rollup.config.aliases.js12
-rw-r--r--thirdparty/preact/config/rollup.config.devtools.js20
-rw-r--r--thirdparty/preact/config/rollup.config.js23
6 files changed, 0 insertions, 216 deletions
diff --git a/thirdparty/preact/config/codemod-const.js b/thirdparty/preact/config/codemod-const.js
deleted file mode 100644
index 4bffd9add..000000000
--- a/thirdparty/preact/config/codemod-const.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* eslint no-console:0 */
-
-/** Find constants (identified by ALL_CAPS_DECLARATIONS), and inline them globally.
- * This is safe because Preact *only* uses global constants.
- */
-export default (file, api) => {
- let j = api.jscodeshift,
- code = j(file.source),
- constants = {},
- found = 0;
-
- code.find(j.VariableDeclaration)
- .filter( decl => {
- for (let i=decl.value.declarations.length; i--; ) {
- let node = decl.value.declarations[i],
- name = node.id && node.id.name,
- init = node.init;
- if (name && init && name.match(/^[A-Z0-9_$]+$/g)) {
- if (init.type==='Literal') {
- console.log(`Inlining constant: ${name}=${init.raw}`);
- found++;
- constants[name] = init;
- // remove declaration
- decl.value.declarations.splice(i, 1);
- // if it's the last, we'll remove the whole statement
- return !decl.value.declarations.length;
- }
- }
- }
- return false;
- })
- .remove();
-
- code.find(j.Identifier)
- .filter( path => path.value.name && constants.hasOwnProperty(path.value.name) )
- .replaceWith( path => (found++, constants[path.value.name]) );
-
- return found ? code.toSource({ quote: 'single' }) : null;
-};
diff --git a/thirdparty/preact/config/codemod-strip-tdz.js b/thirdparty/preact/config/codemod-strip-tdz.js
deleted file mode 100644
index a1f07fafe..000000000
--- a/thirdparty/preact/config/codemod-strip-tdz.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* eslint no-console:0 */
-
-
-// parent node types that we don't want to remove pointless initializations from (because it breaks hoisting)
-const BLOCKED = ['ForStatement', 'WhileStatement']; // 'IfStatement', 'SwitchStatement'
-
-/** Removes var initialization to `void 0`, which Babel adds for TDZ strictness. */
-export default (file, api) => {
- let { jscodeshift } = api,
- found = 0;
-
- let code = jscodeshift(file.source)
- .find(jscodeshift.VariableDeclaration)
- .forEach(handleDeclaration);
-
- function handleDeclaration(decl) {
- let p = decl,
- remove = true;
-
- while ((p = p.parentPath)) {
- if (~BLOCKED.indexOf(p.value.type)) {
- remove = false;
- break;
- }
- }
-
- decl.value.declarations.filter(isPointless).forEach( node => {
- if (remove===false) {
- console.log(`> Skipping removal of undefined init for "${node.id.name}": within ${p.value.type}`);
- }
- else {
- removeNodeInitialization(node);
- }
- });
- }
-
- function removeNodeInitialization(node) {
- node.init = null;
- found++;
- }
-
- function isPointless(node) {
- let { init } = node;
- if (init) {
- if (init.type==='UnaryExpression' && init.operator==='void' && init.argument.value==0) {
- return true;
- }
- if (init.type==='Identifier' && init.name==='undefined') {
- return true;
- }
- }
- return false;
- }
-
- return found ? code.toSource({ quote: 'single' }) : null;
-};
diff --git a/thirdparty/preact/config/eslint-config.js b/thirdparty/preact/config/eslint-config.js
deleted file mode 100644
index 95ac48965..000000000
--- a/thirdparty/preact/config/eslint-config.js
+++ /dev/null
@@ -1,66 +0,0 @@
-module.exports = {
- parser: 'babel-eslint',
- extends: 'eslint:recommended',
- plugins: [
- 'react'
- ],
- env: {
- browser: true,
- mocha: true,
- node: true,
- es6: true
- },
- parserOptions: {
- ecmaFeatures: {
- modules: true,
- jsx: true
- }
- },
- globals: {
- sinon: true,
- expect: true
- },
- rules: {
- 'react/jsx-uses-react': 2,
- 'react/jsx-uses-vars': 2,
- 'no-unused-vars': [1, { varsIgnorePattern: '^h$' }],
- 'no-cond-assign': 1,
- 'no-empty': 0,
- 'no-console': 1,
- semi: 2,
- camelcase: 0,
- 'comma-style': 2,
- 'comma-dangle': [2, 'never'],
- indent: [2, 'tab', {SwitchCase: 1}],
- 'no-mixed-spaces-and-tabs': [2, 'smart-tabs'],
- 'no-trailing-spaces': [2, { skipBlankLines: true }],
- 'max-nested-callbacks': [2, 3],
- 'no-eval': 2,
- 'no-implied-eval': 2,
- 'no-new-func': 2,
- 'guard-for-in': 0,
- eqeqeq: 0,
- 'no-else-return': 2,
- 'no-redeclare': 2,
- 'no-dupe-keys': 2,
- radix: 2,
- strict: [2, 'never'],
- 'no-shadow': 0,
- 'callback-return': [1, ['callback', 'cb', 'next', 'done']],
- 'no-delete-var': 2,
- 'no-undef-init': 2,
- 'no-shadow-restricted-names': 2,
- 'handle-callback-err': 0,
- 'no-lonely-if': 2,
- 'keyword-spacing': 2,
- 'constructor-super': 2,
- 'no-this-before-super': 2,
- 'no-dupe-class-members': 2,
- 'no-const-assign': 2,
- 'prefer-spread': 2,
- 'no-useless-concat': 2,
- 'no-var': 2,
- 'object-shorthand': 2,
- 'prefer-arrow-callback': 2
- }
-};
diff --git a/thirdparty/preact/config/rollup.config.aliases.js b/thirdparty/preact/config/rollup.config.aliases.js
deleted file mode 100644
index e5c549fc3..000000000
--- a/thirdparty/preact/config/rollup.config.aliases.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import memory from 'rollup-plugin-memory';
-import rollupConfig from './rollup.config';
-
-export default Object.assign({}, rollupConfig, {
- plugins: [
- memory({
- path: 'src/preact',
- contents: `import { h } from './preact';export * from './preact';export { h as createElement };`
- }),
- ...rollupConfig.plugins.slice(1)
- ]
-});
diff --git a/thirdparty/preact/config/rollup.config.devtools.js b/thirdparty/preact/config/rollup.config.devtools.js
deleted file mode 100644
index 1fb90b238..000000000
--- a/thirdparty/preact/config/rollup.config.devtools.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import nodeResolve from 'rollup-plugin-node-resolve';
-import babel from 'rollup-plugin-babel';
-
-export default {
- entry: 'devtools/index.js',
- external: ['preact'],
- format: 'umd',
- globals: {
- preact: 'preact'
- },
- moduleName: 'preactDevTools',
- plugins: [
- babel({
- sourceMap: true,
- loose: 'all',
- blacklist: ['es6.tailCall'],
- exclude: 'node_modules/**'
- })
- ]
-}
diff --git a/thirdparty/preact/config/rollup.config.js b/thirdparty/preact/config/rollup.config.js
deleted file mode 100644
index 57f71e1e7..000000000
--- a/thirdparty/preact/config/rollup.config.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import nodeResolve from 'rollup-plugin-node-resolve';
-import babel from 'rollup-plugin-babel';
-import memory from 'rollup-plugin-memory';
-
-export default {
- exports: 'named',
- useStrict: false,
- plugins: [
- memory({
- path: 'src/preact',
- contents: "export * from './preact';"
- }),
- nodeResolve({
- main: true
- }),
- babel({
- sourceMap: true,
- loose: 'all',
- blacklist: ['es6.tailCall'],
- exclude: 'node_modules/**'
- })
- ]
-};