Skip to content

Commit 46c0b2e

Browse files
committed
Remove jQuery from build
Removes jQuery from dependencies, the build process and test runs.
1 parent 5593d7e commit 46c0b2e

8 files changed

Lines changed: 7 additions & 84 deletions

File tree

bin/run-tests.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ function generateTestsFor(packageName) {
6161
testFunctions.push(() => run('package=' + packageName + '&edition=classic'));
6262
testFunctions.push(() => run('package=' + packageName + '&prebuilt=true'));
6363
testFunctions.push(() => run('package=' + packageName + '&enableoptionalfeatures=true'));
64-
65-
// TODO: this should ultimately be deleted (when all packages can run with and
66-
// without jQuery)
67-
if (packageName !== 'ember') {
68-
testFunctions.push(() => run('package=' + packageName + '&jquery=none'));
69-
}
7064
}
7165

7266
function generateEachPackageTests() {

broccoli/packages.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ module.exports.routerES = function _routerES() {
3434
});
3535
};
3636

37-
module.exports.jquery = function _jquery() {
38-
return new Funnel(findLib('jquery'), {
39-
files: ['jquery.js'],
40-
destDir: 'jquery',
41-
annotation: 'jquery',
42-
});
43-
};
44-
4537
module.exports.loader = function _loader() {
4638
return new Funnel('packages/loader/lib', {
4739
files: ['index.js'],

ember-cli-build.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Error.stackTraceLimit = Infinity;
1414

1515
const {
1616
routerES,
17-
jquery,
1817
loader,
1918
qunit,
2019
handlebarsES,
@@ -249,14 +248,7 @@ function templateCompilerBundle(emberPackages, transpileTree) {
249248
}
250249

251250
function testHarness() {
252-
return new MergeTrees([
253-
emptyTestem(),
254-
testPolyfills(),
255-
testIndexHTML(),
256-
loader(),
257-
qunit(),
258-
jquery(),
259-
]);
251+
return new MergeTrees([emptyTestem(), testPolyfills(), testIndexHTML(), loader(), qunit()]);
260252
}
261253

262254
function emptyTestem() {

lib/index.js

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const MergeTrees = require('broccoli-merge-trees');
44
const Funnel = require('broccoli-funnel');
55
const path = require('path');
6-
const resolve = require('resolve');
76
const concatBundle = require('./concat-bundle');
87
const buildDebugMacroPlugin = require('./build-debug-macro-plugin');
98
const buildStripClassCallcheckPlugin = require('./build-strip-class-callcheck-plugin');
@@ -33,7 +32,6 @@ function add(paths, name, path) {
3332
add(paths, 'prod', 'vendor/ember/ember.js');
3433
add(paths, 'debug', 'vendor/ember/ember.js');
3534
add(paths, 'testing', 'vendor/ember/ember-testing.js');
36-
add(paths, 'jquery', 'vendor/ember/jquery/jquery.js');
3735

3836
add(
3937
absolutePaths,
@@ -95,25 +93,6 @@ module.exports = {
9593
);
9694
}
9795

98-
if (
99-
optionalFeaturesMissing ||
100-
typeof optionalFeatures.isFeatureExplicitlySet !== 'function'
101-
) {
102-
message.push(
103-
'* Unable to detect if jquery-integration is explicitly set to a value, please update `@ember/optional-features` to the latest version'
104-
);
105-
}
106-
107-
if (
108-
optionalFeaturesMissing ||
109-
(typeof optionalFeatures.isFeatureExplicitlySet === 'function' &&
110-
!optionalFeatures.isFeatureExplicitlySet('jquery-integration'))
111-
) {
112-
message.push(
113-
`* The jquery-integration optional feature should be explicitly set to a value under Octane, run \`ember feature:disable jquery-integration\` to disable it, or \`ember feature:enable jquery-integration\` to explicitly enable it`
114-
);
115-
}
116-
11796
if (
11897
optionalFeaturesMissing ||
11998
optionalFeatures.isFeatureEnabled('application-template-wrapper')
@@ -165,11 +144,12 @@ module.exports = {
165144
}
166145

167146
this._jqueryIntegrationEnabled =
168-
optionalFeaturesMissing || optionalFeatures.isFeatureEnabled('jquery-integration');
147+
!optionalFeaturesMissing && optionalFeatures.isFeatureEnabled('jquery-integration');
169148

170149
if (this._jqueryIntegrationEnabled) {
171-
this.ui.writeWarnLine(
172-
'Setting the `jquery-integration` optional feature flag to `true`, or not providing a setting at all, has been deprecated. You must add the `@ember/optional-features` addon and set this feature to `false`. This warning will become an error in Ember 4.0.0.\n\nFor more information, see the deprecation guide: https://deprecations.emberjs.com/v3.x/#toc_optional-feature-jquery-integration'
150+
const SilentError = require('silent-error');
151+
throw new SilentError(
152+
'Setting the `jquery-integration` optional feature flag to `true` was deprecated in Ember 3.x and removed in Ember 4.0.0. You must add the `@ember/optional-features` addon and set this feature to `false`.\n\nFor more information, see the deprecation guide: https://deprecations.emberjs.com/v3.x/#toc_optional-feature-jquery-integration'
173153
);
174154
}
175155
},
@@ -237,10 +217,7 @@ module.exports = {
237217
false
238218
);
239219

240-
let exclude = [
241-
isProduction ? 'ember-testing/**' : null,
242-
!this._jqueryIntegrationEnabled ? 'jquery' : null,
243-
].filter((value) => value !== null);
220+
let exclude = isProduction ? ['ember-testing/**'] : [];
244221

245222
let emberFiles = new MergeTrees([new Funnel(packages, { exclude }), dependencies, headerFiles]);
246223

@@ -270,21 +247,6 @@ module.exports = {
270247
},
271248

272249
treeForVendor(tree) {
273-
let jqueryPath;
274-
275-
try {
276-
jqueryPath = path.dirname(
277-
resolve.sync('jquery/package.json', { basedir: this.project.root })
278-
);
279-
} catch (error) {
280-
jqueryPath = path.dirname(require.resolve('jquery/package.json'));
281-
}
282-
283-
let jquery = new Funnel(jqueryPath + '/dist', {
284-
destDir: 'ember/jquery',
285-
files: ['jquery.js'],
286-
});
287-
288250
let templateCompiler = new Funnel(tree, {
289251
destDir: 'ember',
290252
include: ['ember-template-compiler.js', 'ember-template-compiler.map'],
@@ -319,6 +281,6 @@ module.exports = {
319281
});
320282
}
321283

322-
return debugTree(new MergeTrees([ember, templateCompiler, jquery]), 'vendor:final');
284+
return debugTree(new MergeTrees([ember, templateCompiler]), 'vendor:final');
323285
},
324286
};

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
"ember-cli-version-checker": "^5.1.1",
6969
"ember-router-generator": "^2.0.0",
7070
"inflection": "^1.12.0",
71-
"jquery": "^3.5.1",
7271
"resolve": "^1.17.0",
7372
"semver": "^7.3.4",
7473
"silent-error": "^1.1.1"

packages/jquery/index.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/index.html

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@
2929
// Close the script tag to make sure document.write happens
3030
</script>
3131

32-
<script type="text/javascript">
33-
// Fallback to default jQuery
34-
if (jQueryVersion !== 'none' && !window.jQuery) {
35-
loadScript('./jquery/jquery.js');
36-
}
37-
// Close the script tag to make sure document.write happens
38-
</script>
39-
4032
<script>
4133
(function() {
4234
window.EmberENV = window.EmberENV || {};

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6508,11 +6508,6 @@ jmespath@0.15.0:
65086508
resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217"
65096509
integrity "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc= sha512-+kHj8HXArPfpPEKGLZ+kB5ONRTCiGQXo8RQYL0hH8t6pWXUBBK5KkkQmTNOwKK4LEsd0yTsgtjJVm4UBSZea4w=="
65106510

6511-
jquery@^3.5.1:
6512-
version "3.5.1"
6513-
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5"
6514-
integrity sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==
6515-
65166511
js-reporters@1.2.3:
65176512
version "1.2.3"
65186513
resolved "https://registry.yarnpkg.com/js-reporters/-/js-reporters-1.2.3.tgz#8febcab370539df62e09b95da133da04b11f6168"

0 commit comments

Comments
 (0)