msrose / babel-plugin-transform-amd-to-commonjs Goto Github PK
View Code? Open in Web Editor NEW:sparkles: Babel plugin that transforms AMD to CommonJS
License: MIT License
:sparkles: Babel plugin that transforms AMD to CommonJS
License: MIT License
22.5.1
to 22.6.0
.This version is covered by your current version range and after updating it in your project the build failed.
eslint-plugin-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 9 commits.
14d83ef
feat(rules): add no-commented-out rule (#262)
83ff198
chore: migrate no-jest-import to typescript (#259)
718c08c
chore: upgrade @typescript-eslint
ca2aa27
chore: port lowercase-name to TypeScript (#258)
3df0058
chore(ci): run danger with lts version of node
48e3a59
chore: precompile with babel (#257)
8670804
chore: bump deps
05eb11a
chore: fix lint error
dff6446
docs: link to eslint-plugin-jest-formatting
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
22.1.0
to 22.1.1
.This version is covered by your current version range and after updating it in your project the build failed.
eslint-plugin-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 1 commits.
73c9187
fix: add guard for missing assertion invocation (#58)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
22.9.0
to 22.10.0
.This version is covered by your current version range and after updating it in your project the build failed.
eslint-plugin-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 7 commits.
28bd1dc
feat(rules): adds no-if
rule (#293)
7ebdc0e
chore: enforce import destructure order
31c7cef
chore: convert to import/export (#302)
9f858cb
chore: delete tests instead of ignoring them with babel
c595ba0
chore: do not include tests in published tarball
4b4eb78
chore: fix lint error in md file
d3ea720
chore(docs): fix typo (#304)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Hi,
We would like to use this module for our project but it's using syntax (ex: object destructuring) which are not supported in version 4 of nodejs.
The basic example is the first line:
module.exports = ({ types: t }) => {
So, if you could use a subset of ES2015 features (http://node.green/) this module would be usable from older nodejs versions (unfortunately, we can't update to a newer version).
Thanks.
I'm trying to transform an AMD module dijit
(dijit/registry
) to test with jest
Pulling the source in a test show that the generated code is missing the module.exports
line.
Here's a jest test file to show the problem
'use strict';
const {
AMD_DEFINE_RESULT,
MAYBE_FUNCTION,
TRANSFORM_AMD_TO_COMMONJS_IGNORE,
} = require('../src/constants');
const {
checkAmdDefineResult,
checkMaybeFunction,
checkVariableDepAndFactoryResult,
} = require('./test-helpers');
describe('dijit/registry', () => {
it('transforms anonymous define blocks with one dependency', () => {
expect(`
define([
"dojo/_base/array", // array.forEach array.map
"dojo/_base/window", // win.body
"./main" // dijit._scopeName
], function(array, win, dijit){
// module:
// dijit/registry
var _widgetTypeCtr = {}, hash = {};
var registry = {
// summary:
// Registry of existing widget on page, plus some utility methods.
// length: Number
// Number of registered widgets
length: 0,
add: function(widget){
// summary:
// Add a widget to the registry. If a duplicate ID is detected, a error is thrown.
// widget: dijit/_WidgetBase
// Any dijit/_WidgetBase subclass.
if(hash[widget.id]){
throw new Error("Tried to register widget with id==" + widget.id + " but that id is already registered");
}
hash[widget.id] = widget;
this.length++;
},
remove: function(/*String*/ id){
// summary:
// Remove a widget from the registry. Does not destroy the widget; simply
// removes the reference.
if(hash[id]){
delete hash[id];
this.length--;
}
},
byId: function(/*String|Widget*/ id){
// summary:
// Find a widget by it's id.
// If passed a widget then just returns the widget.
return typeof id == "string" ? hash[id] : id; // dijit/_WidgetBase
},
byNode: function(/*DOMNode*/ node){
// summary:
// Returns the widget corresponding to the given DOMNode
return hash[node.getAttribute("widgetId")]; // dijit/_WidgetBase
},
toArray: function(){
// summary:
// Convert registry into a true Array
//
// example:
// Work with the widget .domNodes in a real Array
// | array.map(registry.toArray(), function(w){ return w.domNode; });
var ar = [];
for(var id in hash){
ar.push(hash[id]);
}
return ar; // dijit/_WidgetBase[]
},
getUniqueId: function(/*String*/widgetType){
// summary:
// Generates a unique id for a given widgetType
var id;
do{
id = widgetType + "_" +
(widgetType in _widgetTypeCtr ?
+_widgetTypeCtr[widgetType] : _widgetTypeCtr[widgetType] = 0);
}while(hash[id]);
return dijit._scopeName == "dijit" ? id : dijit._scopeName + "_" + id; // String
},
findWidgets: function(root, skipNode){
// summary:
// Search subtree under root returning widgets found.
// Doesn't search for nested widgets (ie, widgets inside other widgets).
// root: DOMNode
// Node to search under.
// skipNode: DOMNode
// If specified, don't search beneath this node (usually containerNode).
var outAry = [];
function getChildrenHelper(root){
for(var node = root.firstChild; node; node = node.nextSibling){
if(node.nodeType == 1){
var widgetId = node.getAttribute("widgetId");
if(widgetId){
var widget = hash[widgetId];
if(widget){ // may be null on page w/multiple dojo's loaded
outAry.push(widget);
}
}else if(node !== skipNode){
getChildrenHelper(node);
}
}
}
}
getChildrenHelper(root);
return outAry;
},
_destroyAll: function(){
// summary:
// Code to destroy all widgets and do other cleanup on page unload
// Clean up focus manager lingering references to widgets and nodes
dijit._curFocus = null;
dijit._prevFocus = null;
dijit._activeStack = [];
// Destroy all the widgets, top down
array.forEach(registry.findWidgets(win.body()), function(widget){
// Avoid double destroy of widgets like Menu that are attached to <body>
// even though they are logically children of other widgets.
if(!widget._destroyed){
if(widget.destroyRecursive){
widget.destroyRecursive();
}else if(widget.destroy){
widget.destroy();
}
}
});
},
getEnclosingWidget: function(/*DOMNode*/ node){
// summary:
// Returns the widget whose DOM tree contains the specified DOMNode, or null if
// the node is not contained within the DOM tree of any widget
while(node){
var id = node.nodeType == 1 && node.getAttribute("widgetId");
if(id){
return hash[id];
}
node = node.parentNode;
}
return null;
},
// In case someone needs to access hash.
// Actually, this is accessed from WidgetSet back-compatibility code
_hash: hash
};
dijit.registry = registry;
return registry;
});
`).toBeTransformedTo(`
module.exports = (function() {
var array = require("dojo/_base/array");
var win = require( // array.forEach array.map
"dojo/_base/window");
var dijit = require( // win.body
"./main" // dijit._scopeName
); // module:
// dijit/registry
var _widgetTypeCtr = {},
hash = {};
var registry = {
// summary:
// Registry of existing widget on page, plus some utility methods.
// length: Number
// Number of registered widgets
length: 0,
add: function (widget) {
// summary:
// Add a widget to the registry. If a duplicate ID is detected, a error is thrown.
// widget: dijit/_WidgetBase
// Any dijit/_WidgetBase subclass.
if (hash[widget.id]) {
throw new Error("Tried to register widget with id==" + widget.id + " but that id is already registered");
}
hash[widget.id] = widget;
this.length++;
},
remove: function (
/*String*/
id) {
// summary:
// Remove a widget from the registry. Does not destroy the widget; simply
// removes the reference.
if (hash[id]) {
delete hash[id];
this.length--;
}
},
byId: function (
/*String|Widget*/
id) {
// summary:
// Find a widget by it's id.
// If passed a widget then just returns the widget.
return typeof id == "string" ? hash[id] : id; // dijit/_WidgetBase
},
byNode: function (
/*DOMNode*/
node) {
// summary:
// Returns the widget corresponding to the given DOMNode
return hash[node.getAttribute("widgetId")]; // dijit/_WidgetBase
},
toArray: function () {
// summary:
// Convert registry into a true Array
//
// example:
// Work with the widget .domNodes in a real Array
// | array.map(registry.toArray(), function(w){ return w.domNode; });
var ar = [];
for (var id in hash) {
ar.push(hash[id]);
}
return ar; // dijit/_WidgetBase[]
},
getUniqueId: function (
/*String*/
widgetType) {
// summary:
// Generates a unique id for a given widgetType
var id;
do {
id = widgetType + "_" + (widgetType in _widgetTypeCtr ? ++_widgetTypeCtr[widgetType] : _widgetTypeCtr[widgetType] = 0);
} while (hash[id]);
return dijit._scopeName == "dijit" ? id : dijit._scopeName + "_" + id; // String
},
findWidgets: function (root, skipNode) {
// summary:
// Search subtree under root returning widgets found.
// Doesn't search for nested widgets (ie, widgets inside other widgets).
// root: DOMNode
// Node to search under.
// skipNode: DOMNode
// If specified, don't search beneath this node (usually containerNode).
var outAry = [];
function getChildrenHelper(root) {
for (var node = root.firstChild; node; node = node.nextSibling) {
if (node.nodeType == 1) {
var widgetId = node.getAttribute("widgetId");
if (widgetId) {
var widget = hash[widgetId];
if (widget) {
// may be null on page w/multiple dojo's loaded
outAry.push(widget);
}
} else if (node !== skipNode) {
getChildrenHelper(node);
}
}
}
}
getChildrenHelper(root);
return outAry;
},
_destroyAll: function () {
// summary:
// Code to destroy all widgets and do other cleanup on page unload
// Clean up focus manager lingering references to widgets and nodes
dijit._curFocus = null;
dijit._prevFocus = null;
dijit._activeStack = []; // Destroy all the widgets, top down
array.forEach(registry.findWidgets(win.body()), function (widget) {
// Avoid double destroy of widgets like Menu that are attached to <body>
// even though they are logically children of other widgets.
if (!widget._destroyed) {
if (widget.destroyRecursive) {
widget.destroyRecursive();
} else if (widget.destroy) {
widget.destroy();
}
}
});
},
getEnclosingWidget: function (
/*DOMNode*/
node) {
// summary:
// Returns the widget whose DOM tree contains the specified DOMNode, or null if
// the node is not contained within the DOM tree of any widget
while (node) {
var id = node.nodeType == 1 && node.getAttribute("widgetId");
if (id) {
return hash[id];
}
node = node.parentNode;
}
return null;
},
// In case someone needs to access hash.
// Actually, this is accessed from WidgetSet back-compatibility code
_hash: hash
};
dijit.registry = registry;
return registry;
`);
});
});
Hi,
Thanks for this excellent plugin. I'd like to find out if the module (well actually raw code) I passed in was in fact AMD. Do you have any ideas how I can do that? I only need to check the top level.
I will look through your code and try and understand it but as you're the expert maybe you know a quick way or some way to get this lib to tell me.
const { transform } = require('@babel/core');
const requireFromString = require('require-from-string');
const babelOptions = {
...
plugins: [
'babel-plugin-transform-amd-to-commonjs',
],
};
transform(content, babelOptions, (err, result) => {
const module = requireFromString(result.code);
// How do I know when the AMD plugin found and parsed the module as AMD?
});
22.13.0
to 22.13.1
.This version is covered by your current version range and after updating it in your project the build failed.
eslint-plugin-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 23 commits.
6cbaa0f
chore(prefer-todo): migrate to TS (#335)
ed2a0f6
fix(valid-describe): ignore describe.each
(#337)
d0a8428
chore(no-test-callback): migrate to TS (#321)
ccbe766
chore(prefer-strict-equal): migrate to TS (#329)
ee81058
chore(no-test-prefixes): migrate to TS (#328)
e938636
chore(consistent-test-it): migrate to TS (#327)
26ddedd
chore(expect-expect): migrate to TS (#325)
4200e76
chore(prefer-spy-on): migrate to TS (#326)
3a22ef1
chore(no-if): migrate to TS (#324)
4270fca
chore(no-export): migrate to TS (#323)
12e601a
chore(no-hooks): migrate to TS (#322)
f3c654c
chore(no-focused-tests): migrate to TS (#314)
c455100
chore(prefer-inline-snapshots): migrate to TS (#319)
41ed53a
chore(no-duplicate-hooks): migrate to TS (#318)
384b788
chore(no-test-return-statement): migrate to TS (#320)
There are 23 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Hi,
I'm trying to use this plugin to write Jest mock tests for Application Insights, which does not support CommonJS. Unfortunately I can't manage to make it work: for some reason it throws a ReferenceError: define is not defined
when importing Application Insights.
The code of my very small project is at this branch: https://github.com/pviotti/react-appinsights/tree/testing-babel-converter
Here's the relevant configuration (mostly taken from the example project in this repo):
jest.config.js
'use strict';
const webpackConfig = require('./webpack.config');
module.exports = {
moduleNameMapper: webpackConfig.resolve.alias,
transformIgnorePatterns: [
"node_modules/(?!(applicationinsights-js)/)"
],
setupTestFrameworkScriptFile: "<rootDir>/test/setupTests.js"
}
webpack.config.js
'use strict';
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'react-appinsights.bundle.js'
},
module: {
rules: [
{
test: /.js$/,
loader: 'babel-loader'
}
]
},
resolve: {
alias: {
'applicationinsights-js': path.resolve(process.cwd(), './node_modules/applicationinsights-js/bundle/ai.module.js'),
}
}
};
.babelrc
{
"presets": [ "@babel/preset-env", "@babel/preset-react"],
"env": {
"test": {
"plugins": [
"transform-amd-to-commonjs"
]
}
}
}
Hello,
I'd like to know what's the purpose of adding Webpack in the example provided. Is Webpack interfering in any way with the Jest + Babel configuration? (except from reading the Webpack configuration from jest.config.js
).
Could this example work without Webpack by just adding the moduleNameMapper
and moduleDirectories
directly in jest.config.js
?
Thank you
1.14.3
to 1.15.0
.This version is covered by your current version range and after updating it in your project the build failed.
prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Travis doesn't seem to reliably send the build statuses anymore, so dependabot is way behind on its automerging 😞
See the information in #133. It should be clearer in the example why the tools exist as they are and what the bare minimum setup is.
I'm porting a requriejs app over to webpack, and it pulls in jquery-ui. Jquery-ui used a module shim that calls define within another function.
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
}( function( $ ) {
Is there a way to make this babel plugin transform the define call into a require call?
ES6 arrow functions break the transform.
With Arrow
In:
define([
"underscore",
"Constants",
"EventManager",
"config/process/Config",
"config/process/CommonConfig"
], (_, Constants, EventManager, Config, CommonConfig) => {
const obj = {};
...
Out:
__webpack_require__(3);
__webpack_require__(6);
__webpack_require__(9);
__webpack_require__(558);
__webpack_require__(563);
module.exports = function (_, Constants, EventManager, Config, CommonConfig) {
var obj = {};
...
Without Arrow
In:
define([
"underscore",
"Constants",
"EventManager",
"config/process/Config",
"config/process/CommonConfig"
], function (_, Constants, EventManager, Config, CommonConfig) {
const obj = {};
...
Out:
module.exports = function () {
var _ = __webpack_require__(3);
var Constants = __webpack_require__(6);
var EventManager = __webpack_require__(9);
var Config = __webpack_require__(558);
var CommonConfig = __webpack_require__(563);
var obj = {};
...
According to https://github.com/amdjs/amdjs-api/blob/master/AMD.md#factory-
If the factory function returns a value (an object, function, or any value that coerces to true), then that value should be assigned as the exported value for the module.
I've done some work on this, and I have the happy-path working, but there a number of other cases which make a "real" solution a little tough:
Since any dependencies could not be used to influence the literal return, usually this case would occur without any dependencies. In that case, the expected behavior is pretty simple:
define({foo: 'bar'});
// Becomes...
module.exports = {foo: 'bar'};
If there are dependencies, we may need to deviate from the existing factory function behavior (which puts the require()
statements inside the factory function:
define(['sideAffector', {foo: 'bar'});
// Becomes...
require('sideAffector');
module.exports = {foo: 'bar'};
Other than function factories, I think the only other type we have at Hearsay, are objects. That said, any "truthy" value is apparently valid. Detecting "thuthy" values may be non-trivial (impossible?). I'm not sure what the expected behavior is for non-truthy values... noop? For now, it might be sufficient just to export it whatever it is, even if it's falsy.
On line 2, _exports === undefined
, so defineProperty
fails
var amdDefineResult = function () {
Object.defineProperty(_exports, "__esModule", {
value: true
});
Object.defineProperty(_exports, "default", {
enumerable: true,
get: function () {
return _animationTemplateDefinition.default;
}
});
var _exports = exports;
var _animationTemplateDefinition = require("@silvercurve/pixelpipe-ember-data-core/adapters/animation-template-definition");
}();
typeof amdDefineResult !== "undefined" && (module.exports = amdDefineResult);
I'm using your plugin to convert my 3th party AMD dependencies. This seems to be working fine for most of the dependencies. However, one of the libraries is 'uglified' and is injecting 'exports' as variable 'a'. As explained in the caveats, the 'exports' dependencies are skipped. So, variable 'a' is not defined which makes the library faulty.
To resolve the issue, I have cloned your repository, created a branch, added some tests and updated the code base. Unfortunately, I'm not authorized to push my branch to your repository. Can you please give me permission to push the branch? This way, you can validate my changes and merge them if they are acceptable.
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
.nvmrc
with the new onepackage.json
files, so that was left aloneIf you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
We have been writing our code in the CommonJS style as documented in the RequireJS area https://requirejs.org/docs/commonjs.html which doesn't seem like that style works in this plugin. I'm not a babel expert but I could try submitting a PR if it is something worthy to be included.
define(function (require) {
var foo = require('foo');
//Define this module as exporting a function
return function () {
foo.doSomething();
};
});
devDependency
@babel/cli was updated from 7.1.1
to 7.1.2
.devDependency
@babel/core was updated from 7.1.1
to 7.1.2
.devDependency
@babel/preset-env was updated from 7.0.0
to 7.1.0
.This version is covered by your current version range and after updating it in your project the build failed.
This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.
babel7 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
The plugin doesn't handle spread syntax for function arguments in definition.
The following snippet is not transformed correctly.
define(['a', 'b', 'c'], function(...callbacks) {
return (x) => callbacks.forEach((cb) => cb(x));
})
That is transformed to something which crashes with Uncaught SyntaxError: Unexpected token ...
var ...callbacks = require('a');
^^^
require('b');
require('c');
The correct outcome would be something like this.
module.exports = function() {
var [...callbacks] = [require('a'), require('b'), require('c')];
return (x) => callbacks.forEach((cb) => cb(x));
}();
4.35.3
to 4.36.0
.This version is covered by your current version range and after updating it in your project the build failed.
webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
append
option now supports the default placeholders in addition to [url]
"..."
when overriding options.The new version differs by 42 commits.
95d21bb
4.36.0
aa1216c
Merge pull request #9422 from webpack/feature/dot-dot-dot-merge
b3ec775
improve merging of resolve and parsing options
53a5ae2
Merge pull request #9419 from vankop/remove-valid-jsdoc-rule
ab75240
Merge pull request #9413 from webpack/dependabot/npm_and_yarn/ajv-6.10.2
0bdabf4
Merge pull request #9418 from webpack/dependabot/npm_and_yarn/eslint-plugin-jsdoc-15.5.2
f207cdc
remove valid jsdoc rule in favour of eslint-plugin-jsdoc
31333a6
chore(deps-dev): bump eslint-plugin-jsdoc from 15.3.9 to 15.5.2
036adf0
Merge pull request #9417 from webpack/dependabot/npm_and_yarn/eslint-plugin-jest-22.8.0
37d4480
Merge pull request #9411 from webpack/dependabot/npm_and_yarn/simple-git-1.121.0
ce2a183
chore(deps-dev): bump eslint-plugin-jest from 22.7.2 to 22.8.0
0beeb7e
Merge pull request #9391 from vankop/create-hash-typescript
bf1a24a
#9391 resolve super call discussion
bd7d95b
#9391 resolve discussions, AbstractMethodError
4190638
chore(deps): bump ajv from 6.10.1 to 6.10.2
There are 42 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Thanks for your project, it really helped me. Using module-lookup-amd could make your project even better as, as far as I know, many projects using requirejs have a config file. I've started a little experiment that seems to work ok: https://gitlab.com/ftgp/babel-plugin-transform-amd-to-commonjs/commit/8130701480abd4f5c3915a9030006f240bd21e82 (sorry for the noise in the commit, a tool reformated part of your code). If you like it, I can do a PR.
In order to support modules like the exmple in #38:
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
}( function( $ ) {
Since factory is not a function literal, the plugin currently assumes it is a non-function factory, when it could in fact still be a function. See discussion in #38 for how webpack handles this. Likely approach will have to involve a runtime typeof check on the node passed as factory.
It would be great if there was a way to tell the transform to ignore UMD wrapped modules.
We deploy to an environment that uses AMD but historically our testing has been using requirejs
in node. We're switching to this because it's embedded in another package that will make our lives easier overall, buuuuut when we require
modules written as below it fails
it would be great if no matter which type of module we are passing it would survive.
The pattern we have is something like this (grabbed this from one of my templates):
((define) => {
define([], () => {
const exports = {};
//write your code here
return exports;
});
})(
/**
* @description UMD
* @param {Array<strings>} m list of modules
* @param {function} cb callback for define
* @return {undefined}
*/
(m, cb /* jshint -W014, -W030 */) => {
const mod = module.exports;
// eslint-disable-next-line no-unused-expressions,implicit-arrow-linebreak
(typeof define === 'function')
? define(m, cb)
: Object.assign(mod, cb(...m.map(require)));
}
);
I'd be happy with a comment declaration if i had to as a quick starter.
5.15.3
to 5.16.0
.This version is covered by your current version range and after updating it in your project the build failed.
eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
dfef227
Build: gensite passes rulesMeta to formatter rendering (#11567) (Kevin Partington)c06d38c
Fix: Allow HTML formatter to handle no meta data (#11566) (Ilya Volodin)87a5c03
Docs: func-style
: clarify when allowArrowFunctions
is used (#11548) (Oliver Joseph Ash)bc3e427
Update: pass rule meta to formatters RFC 10 (#11551) (Chris Meyer)b452f27
Chore: Update README to pull in reviewer data (#11506) (Nicholas C. Zakas)afe3d25
Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550) (Vernon de Goede)4fe7eb7
Chore: use nyc instead of istanbul (#11532) (Toru Nagashima)f16af43
Chore: fix formatters/table test (#11534) (Toru Nagashima)78358a8
Docs: fix duplicate punctuation in CLI docs (#11528) (Teddy Katz)The new version differs by 11 commits.
ded2f94
5.16.0
ea36e13
Build: changelog update for 5.16.0
dfef227
Build: gensite passes rulesMeta to formatter rendering (#11567)
c06d38c
Fix: Allow HTML formatter to handle no meta data (#11566)
87a5c03
Docs: func-style
: clarify when allowArrowFunctions
is used (#11548)
bc3e427
Update: pass rule meta to formatters RFC 10 (#11551)
b452f27
Chore: Update README to pull in reviewer data (#11506)
afe3d25
Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550)
4fe7eb7
Chore: use nyc instead of istanbul (#11532)
f16af43
Chore: fix formatters/table test (#11534)
78358a8
Docs: fix duplicate punctuation in CLI docs (#11528)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
As described in #44.
For example,
var factory = function(module) {
module.exports = 'sup'
}
define(['module'], factory)
should be transformed to something like
var factory = function(module) {
module.exports = 'sup'
}
if(typeof factory === "function") {
var amdDefineResult = factory(module)
typeof amdDefineResult !== "undefined" && (module.exports = amdDefineResult)
} else {
module.exports = function() {
return factory
}()
}
so that 'sup' is correctly exported, but the amdDefineResult check is missing, so we get
var factory = function(module) {
module.exports = 'sup'
}
module.exports = typeof factory === "function" ? factory(module) : function() {
return factory
}()
instead and undefined
gets exported incorrectly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.