-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CLEANUP beta] Remove jQuery from build #19677
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
const MergeTrees = require('broccoli-merge-trees'); | ||
const Funnel = require('broccoli-funnel'); | ||
const path = require('path'); | ||
const resolve = require('resolve'); | ||
const concatBundle = require('./concat-bundle'); | ||
const buildDebugMacroPlugin = require('./build-debug-macro-plugin'); | ||
const buildStripClassCallcheckPlugin = require('./build-strip-class-callcheck-plugin'); | ||
|
@@ -33,7 +32,6 @@ function add(paths, name, path) { | |
add(paths, 'prod', 'vendor/ember/ember.js'); | ||
add(paths, 'debug', 'vendor/ember/ember.js'); | ||
add(paths, 'testing', 'vendor/ember/ember-testing.js'); | ||
add(paths, 'jquery', 'vendor/ember/jquery/jquery.js'); | ||
|
||
add( | ||
absolutePaths, | ||
|
@@ -65,7 +63,6 @@ module.exports = { | |
name: 'ember-source', | ||
paths, | ||
absolutePaths, | ||
_jqueryIntegrationEnabled: true, | ||
_overrideTree: undefined, | ||
|
||
included() { | ||
|
@@ -95,25 +92,6 @@ module.exports = { | |
); | ||
} | ||
|
||
if ( | ||
optionalFeaturesMissing || | ||
typeof optionalFeatures.isFeatureExplicitlySet !== 'function' | ||
) { | ||
message.push( | ||
'* Unable to detect if jquery-integration is explicitly set to a value, please update `@ember/optional-features` to the latest version' | ||
); | ||
} | ||
|
||
if ( | ||
optionalFeaturesMissing || | ||
(typeof optionalFeatures.isFeatureExplicitlySet === 'function' && | ||
!optionalFeatures.isFeatureExplicitlySet('jquery-integration')) | ||
) { | ||
message.push( | ||
`* 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` | ||
); | ||
} | ||
|
||
if ( | ||
optionalFeaturesMissing || | ||
optionalFeatures.isFeatureEnabled('application-template-wrapper') | ||
|
@@ -164,12 +142,15 @@ module.exports = { | |
} | ||
} | ||
|
||
this._jqueryIntegrationEnabled = | ||
optionalFeaturesMissing || optionalFeatures.isFeatureEnabled('jquery-integration'); | ||
|
||
if (this._jqueryIntegrationEnabled) { | ||
this.ui.writeWarnLine( | ||
'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' | ||
if ( | ||
!optionalFeaturesMissing && | ||
optionalFeatures.isFeatureEnabled('jquery-integration') && | ||
typeof optionalFeatures.isFeatureExplicitlySet === 'function' && | ||
optionalFeatures.isFeatureExplicitlySet('jquery-integration') | ||
) { | ||
const SilentError = require('silent-error'); | ||
throw new SilentError( | ||
'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' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this prose needs work now that the logic has changed. We don't want folks installing the optional features addon at all, we want them to remove the configuration from their There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, ok, I can change that. But I vaguely remember in some past conversations (around jQuery RFCs) that the JSON file was considered an implementation details that users should not directly interact with, rather the "public API" is to use the commands provided by the addon, right? However there is no "remove" command AFAIK. So should I indeed point users to edit the Personally, I am not too much worried about this, just want to make sure... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rwjblue ping 👆 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not inclined to block on getting this dialed in exactly. It seems like we do lack some kind of followup logic for optional features- an ability to see what current settings match the ideal state and GC. Regardless setting to I'm happy to see another PR with further work here (or maybe even across Ember and the optional features repo), but I'm going to land this patch so we can get it into betas ASAP. |
||
); | ||
} | ||
}, | ||
|
@@ -237,10 +218,7 @@ module.exports = { | |
false | ||
); | ||
|
||
let exclude = [ | ||
isProduction ? 'ember-testing/**' : null, | ||
!this._jqueryIntegrationEnabled ? 'jquery' : null, | ||
].filter((value) => value !== null); | ||
let exclude = isProduction ? ['ember-testing/**'] : []; | ||
|
||
let emberFiles = new MergeTrees([new Funnel(packages, { exclude }), dependencies, headerFiles]); | ||
|
||
|
@@ -270,21 +248,6 @@ module.exports = { | |
}, | ||
|
||
treeForVendor(tree) { | ||
let jqueryPath; | ||
|
||
try { | ||
jqueryPath = path.dirname( | ||
resolve.sync('jquery/package.json', { basedir: this.project.root }) | ||
); | ||
} catch (error) { | ||
jqueryPath = path.dirname(require.resolve('jquery/package.json')); | ||
} | ||
|
||
let jquery = new Funnel(jqueryPath + '/dist', { | ||
destDir: 'ember/jquery', | ||
files: ['jquery.js'], | ||
}); | ||
|
||
let templateCompiler = new Funnel(tree, { | ||
destDir: 'ember', | ||
include: ['ember-template-compiler.js', 'ember-template-compiler.map'], | ||
|
@@ -319,6 +282,6 @@ module.exports = { | |
}); | ||
} | ||
|
||
return debugTree(new MergeTrees([ember, templateCompiler, jquery]), 'vendor:final'); | ||
return debugTree(new MergeTrees([ember, templateCompiler]), 'vendor:final'); | ||
}, | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,14 +29,6 @@ | |
// Close the script tag to make sure document.write happens | ||
</script> | ||
|
||
<script type="text/javascript"> | ||
// Fallback to default jQuery | ||
if (jQueryVersion !== 'none' && !window.jQuery) { | ||
loadScript('./jquery/jquery.js'); | ||
} | ||
// Close the script tag to make sure document.write happens | ||
</script> | ||
|
||
<script> | ||
(function() { | ||
window.EmberENV = window.EmberENV || {}; | ||
|
@@ -134,7 +126,7 @@ | |
testsTotal = testsPassed = testsFailed = 0; | ||
|
||
if (QUnit.urlParams.hideskipped) { | ||
$('#qunit-tests').addClass('hideskipped'); | ||
document.getElementById('qunit-tests').classList.add('hideskipped'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the reason for failing FF and Browserstack tests! They used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch!!! |
||
} | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the right thing to do? Or should we assert if anyone sets this feature enabled/disabled at all? As in, they should just remove it from their configuration.
The approach of require
false
is certainly more gentle, but a new 4.0 user would probably look curiously at a requirement to set a feature to disabled which... could not possibly be enabled.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, right, I actually meant to only throw when this is explicitly set to true. I (wrongly) assumed this is already false by default, but it is not. So I will need to revisit this, to make it match RFC705 Phase 2. So I would basically use
isFeatureExplicitlySet
to check if is explicitly set to true, or do noting (optional feature has no effect) otherwise, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have addressed this now!