progress on migrating to heex templates and font-icons

This commit is contained in:
Adam Piontek 2022-08-13 07:32:36 -04:00
parent d43daafdb7
commit 3eff955672
21793 changed files with 2161968 additions and 16895 deletions

View file

@ -0,0 +1,9 @@
{
"presets": [
"airbnb"
],
"plugins": [
"add-module-exports",
["transform-replace-object-assign", { "moduleSpecifier": "object.assign" }],
],
}

View file

@ -0,0 +1,2 @@
test/fixtures
lib/

View file

@ -0,0 +1,5 @@
{
"parser": "babel-eslint",
"extends": "airbnb-base",
"root": true
}

View file

@ -0,0 +1,38 @@
language: node_js
node_js:
- "13"
- "12"
- "11"
- "10"
- "9"
- "8"
- "7"
- "6"
- "5"
- "4"
- "iojs-v3"
- "iojs-v2"
- "iojs-v1"
- "0.12"
import:
- ljharb/travis-ci:node/latest-npm.yml
- ljharb/travis-ci:node/greenkeeper.yml
- ljharb/travis-ci:node/dependabot.yml
script: 'npm run tests-only'
sudo: false
env:
- TEST=true
matrix:
fast_finish: true
include:
- node_js: "lts/*"
env: PRETEST=true
script: 'npm run pretest'
allow_failures:
- node_js: "9"
- node_js: "7"
- node_js: "5"
- node_js: "iojs-v3"
- node_js: "iojs-v2"
- node_js: "iojs-v1"
- env: TEST=true ALLOW_FAILURE=true

View file

@ -0,0 +1,64 @@
## Unreleased
## v2.3.3
- [Fix] Generate webpack-compatible output with static string arg (#84)
- [Fix] Handle visiting the same path gracefully (#71)
## v2.3.2
- [Fix] avoid using reserved param name in babel 7 templates
- [Dev Deps] update `airbnb-js-shims`
## v2.3.1
- [Fix] Evaluate `import()` argument synchronously (#85)
- [Dev Deps] update `eslint`, `eslint-config-airbnb-base`, `in-publish`, `rimraf`, `safe-publish-latest`, `tape`
## v2.3.0
- [New] expose createDynamicImportTransform and getImportSource (#75)
- [Docs] Document noInterop option (#70)
## v2.2.0
- [Refactor] remove dependency on babel-plugin-syntax-dynamic-import
- [Dev Deps] update `airbnb-js-shims`, `babel-preset-airbnb`, `eslint`
## v2.1.0
- [New] add `noInterop` option (#57)
- [Docs] Fix typo "correct" -> "correctly" in readme (#55)
- [Dev Deps] update `airbnb-js-shims`, `babel-eslint`, `babel-preset-airbnb`, `eslint`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `safe-publish-latest`
## v2.0.0
- [Breaking] always return a module namespace object (#52, #47)
- [Breaking] remove `.default` on entry points (#27)
- [Docs] removed $ before npm command (#35)
- [Docs] Improve README.md with a code example (#41)
- [Dev Deps] update `airbnb-js-shims`, `babel-core`, `babel-eslint`, `eslint`, `eslint-plugin-import`
- [Tests] switch from mocha to tape, so we can support older nodes
## v1.2.0
- [New] support comments (#37)
- [Refactor] Use template and types from the babel object (#32)
- [Tests] on `node` `v9`; pin included builds to LTS
- [Dev Deps] update `eslint`, `eslint-config-airbnb-base`, `mocha`, `rimraf`
## v1.1.0
- Visit Import nodes instead of CallExpressions (#30)
- [Deps] update `babel-template`, `babel-types`
- [Dev Deps] update `airbnb-js-shims`, `babel-cli`, `babel-core`, `babel-preset-airbnb`, `babel-register`, `chai`, `eslint`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `mocha`
- [Tests] on `node` `v8`
- [Tests] use `nvm install-latest-npm` so newer npm doesnt break older node
## v1.0.2
- [Fix] Ensure it works with the ES2015 preset too (#12, #16)
- [Deps] update `babel-template`, `babel-types`
- [Dev Deps] update `babel-cli`, `babel-core`, `babel-eslint`, `babel-register`, `eslint`, `eslint-config-airbnb-base`, `mocha`
## v1.0.1
- [Fix] Move `in-publish` to devDeps (#11)
- [Fix] ensure dynamic `import()` input is properly stringified (#2)
- [Fix] async timing of dynamic import to match spec (#3)
- [Fix] Remove spaces in template strings and update Babel (#10)
- [Deps] update `babel-template`, `babel-types`
- [Deps] update `babel-types` (#4, #5, #6)
- [Dev Deps] update `babel-cli`, `babel-core`, `babel-eslint`, `babel-register`, `eslint`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `mocha`, `rimraf`
## v1.0.0
- Initial full release.

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016 Airbnb
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,63 @@
# babel-plugin-dynamic-import-node
Babel plugin to transpile `import()` to a deferred `require()`, for node. Matches the [proposed spec](https://github.com/domenic/proposal-import-function).
**NOTE:** Babylon >= v6.12.0 is required to correctly parse dynamic imports.
## Installation
```sh
npm install babel-plugin-dynamic-import-node --save-dev
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["dynamic-import-node"]
}
```
#### Options
- *`noInterop`* - A boolean value, that if true will not interop the require calls. Useful to avoid using `require('module').default` on commonjs modules.
```json
{
"plugins": [
["dynamic-import-node", { "noInterop": true }]
]
}
```
### Via CLI
```sh
$ babel --plugins dynamic-import-node script.js
```
### Via Node API
```javascript
require('babel-core').transform('code', {
plugins: ['dynamic-import-node']
});
```
### Code Example
```javascript
Promise.all([
import('./lib/import1'),
import('./lib/import2')
]).then(([
Import1,
Import2
]) => {
console.log(Import1);
/* CODE HERE*/
});
```

View file

@ -0,0 +1,37 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = function (api) {
var transformImport = (0, _utils.createDynamicImportTransform)(api);
return {
// NOTE: Once we drop support for Babel <= v6 we should
// update this to import from @babel/plugin-syntax-dynamic-import.
// https://www.npmjs.com/package/@babel/plugin-syntax-dynamic-import
manipulateOptions: function () {
function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push('dynamicImport');
}
return manipulateOptions;
}(),
visitor: {
Import: function () {
function Import(path) {
transformImport(this, path);
}
return Import;
}()
}
};
};
var _utils = require('./utils');
module.exports = exports['default'];

View file

@ -0,0 +1,63 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
exports.getImportSource = getImportSource;
exports.createDynamicImportTransform = createDynamicImportTransform;
function getImportSource(t, callNode) {
var importArguments = callNode.arguments;
var _importArguments = _slicedToArray(importArguments, 1),
importPath = _importArguments[0];
var isString = t.isStringLiteral(importPath) || t.isTemplateLiteral(importPath);
if (isString) {
t.removeComments(importPath);
return importPath;
}
return t.templateLiteral([t.templateElement({ raw: '', cooked: '' }), t.templateElement({ raw: '', cooked: '' }, true)], importArguments);
}
function createDynamicImportTransform(_ref) {
var template = _ref.template,
t = _ref.types;
var builders = {
'static': {
interop: template('Promise.resolve().then(() => INTEROP(require(SOURCE)))'),
noInterop: template('Promise.resolve().then(() => require(SOURCE))')
},
dynamic: {
interop: template('Promise.resolve(SOURCE).then(s => INTEROP(require(s)))'),
noInterop: template('Promise.resolve(SOURCE).then(s => require(s))')
}
};
var visited = typeof WeakSet === 'function' && new WeakSet();
var isString = function isString(node) {
return t.isStringLiteral(node) || t.isTemplateLiteral(node) && node.expressions.length === 0;
};
return function (context, path) {
if (visited) {
if (visited.has(path)) {
return;
}
visited.add(path);
}
var SOURCE = getImportSource(t, path.parent);
var builder = isString(SOURCE) ? builders['static'] : builders.dynamic;
var newImport = context.opts.noInterop ? builder.noInterop({ SOURCE: SOURCE }) : builder.interop({ SOURCE: SOURCE, INTEROP: context.addHelper('interopRequireWildcard') });
path.parentPath.replaceWith(newImport);
};
}

View file

@ -0,0 +1,71 @@
{
"name": "babel-plugin-dynamic-import-node",
"version": "2.3.3",
"description": "Babel plugin to transpile import() to a deferred require(), for node",
"main": "lib/index.js",
"directories": {
"test": "test"
},
"scripts": {
"clean": "rimraf lib",
"prebuild": "npm run clean",
"build": "babel src --out-dir lib",
"pretest": "npm run lint",
"test": "npm run tests-only",
"tests-only": "tape --require airbnb-js-shims --require babel-register test",
"lint": "eslint .",
"prepublish": "not-in-publish || (safe-publish-latest && npm run build)",
"check-changelog": "expr $(git status --porcelain 2>/dev/null| grep \"^\\s*M.*CHANGELOG.md\" | wc -l) >/dev/null || (echo 'Please edit CHANGELOG.md' && exit 1)",
"check-only-changelog-changed": "(expr $(git status --porcelain 2>/dev/null| grep -v \"CHANGELOG.md\" | wc -l) >/dev/null && echo 'Only CHANGELOG.md may have uncommitted changes' && exit 1) || exit 0",
"version:major": "npm --no-git-tag-version version major",
"version:minor": "npm --no-git-tag-version version minor",
"version:patch": "npm --no-git-tag-version version patch",
"postversion": "git commit package.json CHANGELOG.md -m \"v$npm_package_version\" && npm run tag && git push && git push --tags",
"preversion": "npm run test && npm run check-changelog && npm run check-only-changelog-changed",
"tag": "git tag v$npm_package_version"
},
"repository": {
"type": "git",
"url": "git+https://github.com/airbnb/babel-plugin-dynamic-import-node.git"
},
"keywords": [
"babel",
"plugin",
"dynamic",
"import",
"node"
],
"author": "Jordan Gensler <jordan.gensler@airbnb.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/airbnb/babel-plugin-dynamic-import-node/issues"
},
"homepage": "https://github.com/airbnb/babel-plugin-dynamic-import-node#readme",
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-external-helpers": "^7.8.3",
"@babel/plugin-transform-template-literals": "^7.8.3",
"@babel/preset-env": "^7.9.5",
"airbnb-js-shims": "^2.2.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^9.0.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-plugin-transform-replace-object-assign": "^1.0.0",
"babel-preset-airbnb": "^2.6.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.26.0",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-plugin-import": "^2.20.2",
"in-publish": "^2.0.1",
"rimraf": "^2.7.1",
"safe-publish-latest": "^1.1.4",
"tape": "^5.0.0-next.5"
},
"dependencies": {
"object.assign": "^4.1.0"
}
}

View file

@ -0,0 +1,6 @@
// Re-export lib/utils, so that consumers can import
// babel-plugin-dynamic-import-node/utils instead of
// babel-plugin-dynamic-import-node/lib/utils
// eslint-disable-next-line import/no-unresolved
module.exports = require('./lib/utils');