-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
26 changed files
with
680 additions
and
439 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
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,5 @@ | ||
{ | ||
"rules": { | ||
"local/prefer-spread-props": 0 | ||
} | ||
} |
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,14 @@ | ||
// For an explanation of the OWNERS rules and syntax, see: | ||
// https://github.com/ampproject/amp-github-apps/blob/master/owners/OWNERS.example | ||
|
||
{ | ||
rules: [ | ||
{ | ||
owners: [ | ||
{name: 'ampproject/wg-infra'}, | ||
{name: 'ampproject/wg-runtime'}, | ||
{name: 'ampproject/wg-performance'}, | ||
], | ||
}, | ||
], | ||
} |
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,61 @@ | ||
/** | ||
* Copyright 2020 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
const {getDevDependencies} = require('./dev-dependencies'); | ||
|
||
/** | ||
* Gets the config for babel transforms run during `gulp dep-check`. | ||
* | ||
* @return {!Object} | ||
*/ | ||
function getDepCheckConfig() { | ||
const reactJsxPlugin = [ | ||
'@babel/plugin-transform-react-jsx', | ||
{ | ||
pragma: 'Preact.createElement', | ||
pragmaFrag: 'Preact.Fragment', | ||
useSpread: true, | ||
}, | ||
]; | ||
const presetEnv = [ | ||
'@babel/preset-env', | ||
{ | ||
bugfixes: true, | ||
modules: 'commonjs', | ||
loose: true, | ||
targets: {'browsers': ['Last 2 versions']}, | ||
}, | ||
]; | ||
const depCheckPlugins = [ | ||
'./build-system/babel-plugins/babel-plugin-transform-fix-leading-comments', | ||
'@babel/plugin-transform-react-constant-elements', | ||
'@babel/plugin-transform-classes', | ||
reactJsxPlugin, | ||
]; | ||
const depCheckPresets = [presetEnv]; | ||
const devDependencies = getDevDependencies(); | ||
return { | ||
compact: false, | ||
ignore: devDependencies, | ||
plugins: depCheckPlugins, | ||
presets: depCheckPresets, | ||
}; | ||
} | ||
|
||
module.exports = { | ||
getDepCheckConfig, | ||
}; |
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,33 @@ | ||
/** | ||
* Copyright 2020 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
const packageJson = require('../../package.json'); | ||
|
||
/** | ||
* Gets relative paths to all the devDependencies defined in package.json. | ||
* | ||
* @return {!Array<string>} | ||
*/ | ||
function getDevDependencies() { | ||
return Object.keys(packageJson.devDependencies).map( | ||
(dependency) => `./node_modules/${dependency}` | ||
); | ||
} | ||
|
||
module.exports = { | ||
getDevDependencies, | ||
}; |
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,34 @@ | ||
/** | ||
* Copyright 2020 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
|
||
/** | ||
* Populates a single object with the babel configs from all the *-config.js | ||
* files in this directory. | ||
* | ||
* @return {!Object} | ||
*/ | ||
function getAllBabelConfigs() { | ||
const babelConfigFiles = fs | ||
.readdirSync(__dirname) | ||
.filter((file) => file.includes('-config.js')); | ||
const babelConfigs = babelConfigFiles.map((file) => require(`./${file}`)); | ||
return Object.assign({}, ...babelConfigs); | ||
} | ||
|
||
module.exports = getAllBabelConfigs(); |
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,69 @@ | ||
/** | ||
* Copyright 2020 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
const argv = require('minimist')(process.argv.slice(2)); | ||
|
||
/** | ||
* Gets the config for post-closure babel transforms run during `gulp dist --esm`. | ||
* | ||
* @return {!Object} | ||
*/ | ||
function getPostClosureConfig() { | ||
if (!argv.esm) { | ||
return {}; | ||
} | ||
|
||
const reactJsxPlugin = [ | ||
'@babel/plugin-transform-react-jsx', | ||
{ | ||
pragma: 'Preact.createElement', | ||
pragmaFrag: 'Preact.Fragment', | ||
useSpread: true, | ||
}, | ||
]; | ||
const postClosurePlugins = [ | ||
'./build-system/babel-plugins/babel-plugin-transform-minified-comments', | ||
'./build-system/babel-plugins/babel-plugin-const-transformer', | ||
'./build-system/babel-plugins/babel-plugin-transform-remove-directives', | ||
'./build-system/babel-plugins/babel-plugin-transform-function-declarations', | ||
'./build-system/babel-plugins/babel-plugin-transform-stringish-literals', | ||
'./build-system/babel-plugins/babel-plugin-transform-fix-leading-comments', | ||
'@babel/plugin-transform-react-constant-elements', | ||
reactJsxPlugin, | ||
]; | ||
const presetEnv = [ | ||
'@babel/preset-env', | ||
{ | ||
bugfixes: true, | ||
modules: false, | ||
targets: {'esmodules': true}, | ||
}, | ||
]; | ||
const postClosurePresets = [presetEnv]; | ||
return { | ||
compact: false, | ||
inputSourceMap: false, | ||
plugins: postClosurePlugins, | ||
presets: postClosurePresets, | ||
retainLines: false, | ||
sourceMaps: true, | ||
}; | ||
} | ||
|
||
module.exports = { | ||
getPostClosureConfig, | ||
}; |
Oops, something went wrong.