diff --git a/.circleci/config.yml b/.circleci/config.yml index e0aeb2d6091..008e8c1bea5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -464,12 +464,6 @@ jobs: - run: name: Test plot-schema.json diff - If failed, after (npm start) you could run (npm run schema && git add test/plot-schema.json && git commit -m "update plot-schema diff") command: diff --unified --color dist/plot-schema.json test/plot-schema.json - - run: - name: Test plotly.min.js import using amdefine - command: npm run test-amdefine - - run: - name: Test plotly.min.js import using requirejs - command: npm run test-requirejs test-stackgl-bundle: docker: diff --git a/draftlogs/7229_remove.md b/draftlogs/7229_remove.md new file mode 100644 index 00000000000..9305d083052 --- /dev/null +++ b/draftlogs/7229_remove.md @@ -0,0 +1 @@ + - Drop AMD support from bundle header [[#7229](https://github.com/plotly/plotly.js/pull/7229)] diff --git a/package.json b/package.json index f0c562db62a..db46f03968e 100644 --- a/package.json +++ b/package.json @@ -47,8 +47,6 @@ "test-export": "node test/image/export_test.js", "test-syntax": "node tasks/test_syntax.js && npm run find-strings -- --no-output", "test-bundle": "node tasks/test_bundle.js", - "test-amdefine": "node tasks/test_amdefine.js", - "test-requirejs": "node tasks/test_requirejs.js", "test-plain-obj": "node tasks/test_plain_obj.mjs", "test": "npm run test-jasmine -- --nowatch && npm run test-bundle && npm run test-image && npm run test-export && npm run test-syntax && npm run lint", "b64": "python3 test/image/generate_b64_mocks.py && node devtools/test_dashboard/server.mjs", diff --git a/tasks/test_amdefine.js b/tasks/test_amdefine.js deleted file mode 100644 index 7f343e7a775..00000000000 --- a/tasks/test_amdefine.js +++ /dev/null @@ -1,28 +0,0 @@ -var JSDOM = require('jsdom').JSDOM; -global.document = new JSDOM('').window.document; -global.window = document.defaultView; -global.window.document = global.document; -global.self = global.window; -global.Blob = global.window.Blob; -global.DOMParser = global.window.DOMParser; -global.getComputedStyle = global.window.getComputedStyle; -global.window.URL.createObjectURL = function() {}; - -// see: Building node modules with AMD or RequireJS https://requirejs.org/docs/node.html -if(typeof define !== 'function') { - var define = require('amdefine')(module); -} - -define(function(require) { - var plotly = require('../dist/plotly.min.js'); - - if(plotly && plotly.PlotSchema) { - console.log(plotly); - } else { - throw 'Error: loading with amdefine'; - } - - // The value returned from the function is - // used as the module export visible to Node. - return function() {}; -}); diff --git a/tasks/test_requirejs.js b/tasks/test_requirejs.js deleted file mode 100644 index a3a39494e89..00000000000 --- a/tasks/test_requirejs.js +++ /dev/null @@ -1,26 +0,0 @@ -var JSDOM = require('jsdom').JSDOM; -global.document = new JSDOM('').window.document; -global.window = document.defaultView; -global.window.document = global.document; -global.self = global.window; -global.Blob = global.window.Blob; -global.DOMParser = global.window.DOMParser; -global.getComputedStyle = global.window.getComputedStyle; -global.window.URL.createObjectURL = function() {}; - -var requirejs = require('requirejs'); - -requirejs.config({ - paths: { - 'plotly': '../dist/plotly.min' - } -}); - -requirejs(['plotly'], -function(plotly) { - if(plotly && plotly.PlotSchema) { - console.log(plotly); - } else { - throw 'Error: loading with requirejs'; - } -}); diff --git a/tasks/util/bundle_wrapper.mjs b/tasks/util/bundle_wrapper.mjs index 5245bc58c78..189c391027e 100644 --- a/tasks/util/bundle_wrapper.mjs +++ b/tasks/util/bundle_wrapper.mjs @@ -56,9 +56,7 @@ function addWrapper(path){ [ '(', ' function(root, factory) {', - ' if (typeof define === "function" && define.amd) {', - ' define(factory);', - ' } else if (typeof module === "object" && module.exports) {', + ' if (typeof module === "object" && module.exports) {', ' module.exports = factory();', ' } else {', ' root.moduleName = factory();', @@ -73,9 +71,7 @@ function addWrapper(path){ path, [ '', - 'if (!(typeof define === "function" && define.amd)) {', - ' window.Plotly = Plotly;', - '}', + 'window.Plotly = Plotly;', 'return Plotly;', '}));', ].join('\n'),