mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Support for transpiling .js
files (#9160)
* Remove some `.es6` from comments where it does not matter * Use a post processor for transpilation This will allow us to eventually use the directory structure to transpile rather than the extension. * FIX: Some errors and clean up in confirm-new-email It would throw an error if the webauthn element wasn't present. Also I changed things so that no-module is not explicitly referenced. * Remove `no-module` Instead we allow a magic comment: `// discourse-skip-module` to prevent the asset pipeline from creating a module. * DEV: Enable babel transpilation based on directory If it's in `app/assets/javascripts/dicourse` it will be transpiled even without the `.es6` extension. * REFACTOR: Remove Tilt/ES6ModuleTranspiler
This commit is contained in:
parent
fd4ce6ab8f
commit
a3f0543f99
38 changed files with 152 additions and 265 deletions
|
@ -1,3 +1,4 @@
|
|||
// discourse-skip-module
|
||||
(function() {
|
||||
setTimeout(function() {
|
||||
const $activateButton = $("#activate-account-button");
|
|
@ -1,3 +1,4 @@
|
|||
// discourse-skip-module
|
||||
(function() {
|
||||
const path = document.getElementById("data-auto-redirect").dataset.path;
|
||||
setTimeout(function() {
|
|
@ -0,0 +1,4 @@
|
|||
// discourse-skip-module
|
||||
(function() {
|
||||
require("confirm-new-email/confirm-new-email");
|
||||
})();
|
|
@ -1,23 +1,26 @@
|
|||
import { getWebauthnCredential } from "discourse/lib/webauthn";
|
||||
|
||||
document.getElementById("submit-security-key").onclick = function(e) {
|
||||
e.preventDefault();
|
||||
getWebauthnCredential(
|
||||
document.getElementById("security-key-challenge").value,
|
||||
document
|
||||
.getElementById("security-key-allowed-credential-ids")
|
||||
.value.split(","),
|
||||
credentialData => {
|
||||
document.getElementById("security-key-credential").value = JSON.stringify(
|
||||
credentialData
|
||||
);
|
||||
const security = document.getElementById("submit-security-key");
|
||||
if (security) {
|
||||
security.onclick = function(e) {
|
||||
e.preventDefault();
|
||||
getWebauthnCredential(
|
||||
document.getElementById("security-key-challenge").value,
|
||||
document
|
||||
.getElementById("security-key-allowed-credential-ids")
|
||||
.value.split(","),
|
||||
credentialData => {
|
||||
document.getElementById(
|
||||
"security-key-credential"
|
||||
).value = JSON.stringify(credentialData);
|
||||
|
||||
$(e.target)
|
||||
.parents("form")
|
||||
.submit();
|
||||
},
|
||||
errorMessage => {
|
||||
document.getElementById("security-key-error").innerText = errorMessage;
|
||||
}
|
||||
);
|
||||
};
|
||||
$(e.target)
|
||||
.parents("form")
|
||||
.submit();
|
||||
},
|
||||
errorMessage => {
|
||||
document.getElementById("security-key-error").innerText = errorMessage;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
require("confirm-new-email/confirm-new-email").default();
|
|
@ -6,7 +6,7 @@ import {
|
|||
isWebauthnSupported
|
||||
} from "discourse/lib/webauthn";
|
||||
|
||||
// model for this controller is user.js.es6
|
||||
// model for this controller is user
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
loading: false,
|
||||
errorMessage: null,
|
||||
|
|
|
@ -848,7 +848,7 @@ class PluginApi {
|
|||
*
|
||||
* Example:
|
||||
*
|
||||
* // read /discourse/lib/sharing.js.es6 for options
|
||||
* // read discourse/lib/sharing for options
|
||||
* api.addSharingSource(options)
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -12,7 +12,7 @@ export function resetExtraClasses() {
|
|||
}
|
||||
|
||||
// Note: In plugins, define a class by path and it will be wired up automatically
|
||||
// eg: discourse/connectors/<OUTLET NAME>/<CONNECTOR NAME>.js.es6
|
||||
// eg: discourse/connectors/<OUTLET NAME>/<CONNECTOR NAME>
|
||||
export function extraConnectorClass(name, obj) {
|
||||
_extraConnectorClasses[name] = obj;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// discourse-skip-module
|
||||
(function() {
|
||||
const referer = document.getElementById("data-embedded").dataset.referer;
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
// discourse-skip-module
|
||||
(function() {
|
||||
const gtmDataElement = document.getElementById("data-google-tag-manager");
|
||||
const dataLayerJson = JSON.parse(gtmDataElement.dataset.dataLayer);
|
|
@ -1,3 +1,4 @@
|
|||
// discourse-skip-module
|
||||
/* eslint-disable */
|
||||
// prettier-ignore
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
@ -1,3 +1,4 @@
|
|||
// discourse-skip-module
|
||||
window.onpopstate = function(event) {
|
||||
// check if Discourse object exists if not take care of back navigation
|
||||
if (event.state && !window.hasOwnProperty("Discourse")) {
|
|
@ -1,3 +1,4 @@
|
|||
// discourse-skip-module
|
||||
(function() {
|
||||
var ps = require("preload-store").default;
|
||||
var preloadedDataElement = document.getElementById("data-preloaded");
|
||||
|
@ -55,6 +56,7 @@
|
|||
Discourse.S3BaseUrl = setupData.s3BaseUrl;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
Ember.RSVP.configure("onerror", function(e) {
|
||||
// Ignore TransitionAborted exceptions that bubble up
|
||||
if (e && e.message === "TransitionAborted") {
|
|
@ -1,3 +1,4 @@
|
|||
// discourse-skip-module
|
||||
(function() {
|
||||
var wizard = require("wizard/wizard").default.create();
|
||||
wizard.start();
|
|
@ -73,10 +73,10 @@
|
|||
<%end%>
|
||||
<% end%>
|
||||
|
||||
<%= preload_script "ember_jquery" %>
|
||||
<%= preload_script "locales/#{I18n.locale}" %>
|
||||
<%= preload_script "locales/i18n" %>
|
||||
<%= preload_script "discourse/lib/webauthn" %>
|
||||
<%= preload_script "confirm-new-email/confirm-new-email" %>
|
||||
<%= preload_script "confirm-new-email/confirm-new-email.no-module" %>
|
||||
<%= preload_script "ember_jquery" %>
|
||||
<%= preload_script "locales/#{I18n.locale}" %>
|
||||
<%= preload_script "locales/i18n" %>
|
||||
<%= preload_script "discourse/lib/webauthn" %>
|
||||
<%= preload_script "confirm-new-email/confirm-new-email" %>
|
||||
<%= preload_script "confirm-new-email/bootstrap" %>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue