-
-
Notifications
You must be signed in to change notification settings - Fork 934
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement importmap-rails with minimal js changes (#4396)
Add importmap:verify to check vendored javascript Run importmap:verify as part of lint Update content security policy based on recommendations from google csp validator in order to get importmap script tag to load. Use a random base64 if a nonce isn't available from the session Use script-src: sha256-* instead of nonce for importmap script tag This allows the importmap to be cached without creating a long lived nonce in the cache Fix issue with blank cookie causing rack-test crash
- Loading branch information
1 parent
3453412
commit 29d69a5
Showing
37 changed files
with
508 additions
and
924 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
//= link application.css | ||
//= link application.js | ||
//= link_tree ../../../vendor/assets/images | ||
//= link_tree ../builds | ||
//= link_tree ../../javascript .js | ||
//= link_tree ../../../vendor/javascript .js |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
app/assets/javascripts/api_key_form.js → app/javascript/api_key_form.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails | ||
import Rails from "@rails/ujs"; | ||
Rails.start(); | ||
|
||
import "./api_key_form"; | ||
import "./autocomplete"; | ||
import "./clipboard_buttons"; | ||
import "./mobile-nav"; | ||
import "./multifactor_auths"; | ||
import "./oidc_api_key_role_form"; | ||
import "./pages"; | ||
import "./popup-nav"; | ||
import "./search"; | ||
import "./transitive_dependencies"; | ||
import "./webauthn"; | ||
import "github-buttons"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
app/assets/javascripts/clipboard_buttons.js → app/javascript/clipboard_buttons.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export function handleClick( | ||
event, | ||
nav, | ||
removeNavExpandedClass, | ||
addNavExpandedClass | ||
) { | ||
var isMobileNavExpanded = nav.popUp.hasClass(nav.expandedClass); | ||
|
||
event.preventDefault(); | ||
|
||
if (isMobileNavExpanded) { | ||
removeNavExpandedClass(); | ||
} else { | ||
addNavExpandedClass(); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
app/assets/javascripts/mobile-nav.js → app/javascript/mobile-nav.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
app/assets/javascripts/multifactor_auths.js → app/javascript/multifactor_auths.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...ets/javascripts/oidc_api_key_role_form.js → app/javascript/oidc_api_key_role_form.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...ts/javascripts/transitive_dependencies.js → app/javascript/transitive_dependencies.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require_relative "../config/application" | ||
require "importmap/commands" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Pin npm packages by running ./bin/importmap | ||
|
||
pin "application", preload: true | ||
|
||
# vendored and adapted from https://github.com/mdo/github-buttons/blob/master/src/js.js | ||
pin "github-buttons" | ||
# vendored from github in the before times | ||
pin "webauthn-json" | ||
|
||
pin "jquery" # @3.7.1 | ||
pin "@rails/ujs", to: "@rails--ujs.js" # @7.1.3 | ||
pin "clipboard" # @2.0.11 |
Oops, something went wrong.