-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix gulp integration and server so that it can work with mjs files (#…
…30292) * make it so that src transformation only happens strictly in scripts/script-transform.ts each module should do 1 thing and 1 thing only. currently the module transformer also did a src/url transformation. this caused weird mismatches when they are ran together. - added looseScriptSrcCheck to allow for non cdn domains. This will allow us to transition from the bad fixture files to having all html files be valid AMP HTML by default. * temp * temp * fix imports * add transform back to integration * fix html * fix integration * temp * temp * make transformers have a loose mode to be more forgiving on script src * add more tests and fix bug for extention retention * allow for mjs files to be served by the test server * add glob to load mjs files in karma server * lint fixes * lint html * break up this PR * fix bad error formatting * apply recs * Update build-system/server/new-server/transforms/transform.ts Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * Update build-system/server/new-server/transforms/utilities/option-set.ts Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * fix other locations of "FORTESTING" * fix esm and non esm tests to be green * use writeFileSync instead of async method. seems to be a race * guarantee directory exists first * fix windows issues * skip failing IE test temporarily * applied recs * apply more recs * temporarily read from testing version.txt * temp "only" * dont reroute to max json files * change error to warning * fix max builds and integration tests against max files * revert testing changes. we'll separete it into its own PR Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
- Loading branch information
1 parent
b025f30
commit 73b3f0e
Showing
49 changed files
with
306 additions
and
112 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
4 changes: 4 additions & 0 deletions
4
build-system/server/new-server/transforms/css/test/no-insert/input.html
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 @@ | ||
<head> | ||
<style amp-runtime>.amp-runtime{}</style> | ||
<style amp-custom>.my-personal-style {}</style> | ||
</head> |
4 changes: 4 additions & 0 deletions
4
build-system/server/new-server/transforms/css/test/no-insert/output.html
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 @@ | ||
<head> | ||
<style amp-runtime="">.amp-runtime{}</style> | ||
<style amp-custom="">.my-personal-style {}</style> | ||
</head> |
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: 0 additions & 3 deletions
3
build-system/server/new-server/transforms/modules/test/esm-env-compiled/options.json
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
build-system/server/new-server/transforms/modules/test/esm-env-compiled/output.html
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
build-system/server/new-server/transforms/modules/test/esm-env/options.json
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
build-system/server/new-server/transforms/modules/test/esm-env/output.html
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
.../modules/test/esm-env-compiled/input.html → ...test/module-nomodule-cdn-input/input.html
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,3 +1,4 @@ | ||
<head> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<script async src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script> | ||
</head> |
6 changes: 6 additions & 0 deletions
6
build-system/server/new-server/transforms/modules/test/module-nomodule-cdn-input/output.html
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,6 @@ | ||
<head> | ||
<script async="" src="https://cdn.ampproject.org/v0.js" nomodule=""></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.mjs" type="module"></script> | ||
<script async="" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js" nomodule=""></script> | ||
<script async="" src="https://cdn.ampproject.org/v0/amp-bind-0.1.mjs" type="module"></script> | ||
</head> |
5 changes: 5 additions & 0 deletions
5
...erver/new-server/transforms/modules/test/module-nomodule-localhost-input-loose/input.html
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,5 @@ | ||
<head> | ||
<script async src="http://localhost:8000/amp.js"></script> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<script async src="http://localhost:8000/v0/amp-bind-0.1.js"></script> | ||
</head> |
3 changes: 3 additions & 0 deletions
3
...ver/new-server/transforms/modules/test/module-nomodule-localhost-input-loose/options.json
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,3 @@ | ||
{ | ||
"looseScriptSrcCheck": true | ||
} |
8 changes: 8 additions & 0 deletions
8
...rver/new-server/transforms/modules/test/module-nomodule-localhost-input-loose/output.html
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,8 @@ | ||
<head> | ||
<script async="" src="http://localhost:8000/amp.js" nomodule=""></script> | ||
<script async="" src="http://localhost:8000/amp.mjs" type="module"></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.js" nomodule=""></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.mjs" type="module"></script> | ||
<script async="" src="http://localhost:8000/v0/amp-bind-0.1.js" nomodule=""></script> | ||
<script async="" src="http://localhost:8000/v0/amp-bind-0.1.mjs" type="module"></script> | ||
</head> |
5 changes: 5 additions & 0 deletions
5
...rver/new-server/transforms/modules/test/module-nomodule-localhost-input-strict/input.html
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,5 @@ | ||
<head> | ||
<script async src="http://localhost:8000/amp.js"></script> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<script async src="http://localhost:8000/v0/amp-bind-0.1.js"></script> | ||
</head> |
6 changes: 6 additions & 0 deletions
6
...ver/new-server/transforms/modules/test/module-nomodule-localhost-input-strict/output.html
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,6 @@ | ||
<head> | ||
<script async="" src="http://localhost:8000/amp.js"></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.js" nomodule=""></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.mjs" type="module"></script> | ||
<script async="" src="http://localhost:8000/v0/amp-bind-0.1.js"></script> | ||
</head> |
1 change: 1 addition & 0 deletions
1
...ransforms/modules/test/esm-env/input.html → ...module-replace-nomodule-script/input.html
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,3 +1,4 @@ | ||
<head> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<script async src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script> | ||
</head> |
4 changes: 4 additions & 0 deletions
4
...tem/server/new-server/transforms/modules/test/module-replace-nomodule-script/options.json
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 @@ | ||
{ | ||
"esm": true, | ||
"fortesting": true | ||
} |
4 changes: 4 additions & 0 deletions
4
...stem/server/new-server/transforms/modules/test/module-replace-nomodule-script/output.html
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 @@ | ||
<head> | ||
<script async="" src="https://cdn.ampproject.org/v0.mjs" type="module"></script> | ||
<script async="" src="https://cdn.ampproject.org/v0/amp-bind-0.1.mjs" type="module"></script> | ||
</head> |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/modules/test/skip-over-json-script/input.html
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,3 @@ | ||
<head> | ||
<script type="application/json">{}</script> | ||
</head> |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/modules/test/skip-over-json-script/output.html
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,3 @@ | ||
<head> | ||
<script type="application/json">{}</script> | ||
</head> |
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
build-system/server/new-server/transforms/scripts/test/convert-to-max-names/input.html
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,3 @@ | ||
<script src="https://cdn.ampproject.org/v0.js" async></script> | ||
<script src="https://cdn.ampproject.org/v0/amp-bind-0.1.js" async></script> | ||
<script src="https://cdn.ampproject.org/v0/amp-bind-0.2.js" async></script> |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/scripts/test/convert-to-max-names/options.json
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,3 @@ | ||
{ | ||
"useMaxNames": true | ||
} |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/scripts/test/convert-to-max-names/output.html
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,3 @@ | ||
<script src="http://localhost:8000/dist/amp.js" async=""></script> | ||
<script src="http://localhost:8000/dist/v0/amp-bind-0.1.max.js" async=""></script> | ||
<script src="http://localhost:8000/dist/v0/amp-bind-0.2.max.js" async=""></script> |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/scripts/test/invalid-src-loose/input.html
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,3 @@ | ||
<script src="https://cdn/v0.js" async></script> | ||
<script src="amp.js" async></script> | ||
<script src="http://localhost:8000/amp.js" async></script> |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/scripts/test/invalid-src-loose/options.json
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,3 @@ | ||
{ | ||
"looseScriptSrcCheck": true | ||
} |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/scripts/test/invalid-src-loose/output.html
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,3 @@ | ||
<script src="http://localhost:8000/dist/v0.js" async=""></script> | ||
<script src="http://localhost:8000/dist/amp.js" async=""></script> | ||
<script src="http://localhost:8000/dist/amp.js" async=""></script> |
1 change: 1 addition & 0 deletions
1
...forms/scripts/test/invalid-src/input.html → ...cripts/test/invalid-src-strict/input.html
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 +1,2 @@ | ||
<script src="https://cdn/v0.js" async></script> | ||
<script src="/dist/amp.js" async></script> |
1 change: 1 addition & 0 deletions
1
...orms/scripts/test/invalid-src/output.html → ...ripts/test/invalid-src-strict/output.html
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 +1,2 @@ | ||
<script src="https://cdn/v0.js" async=""></script> | ||
<script src="/dist/amp.js" async=""></script> |
5 changes: 5 additions & 0 deletions
5
build-system/server/new-server/transforms/scripts/test/port-transform-loose/input.html
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,5 @@ | ||
<script async="" src="http://localhost:8000/amp.js"></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.js" nomodule=""></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.mjs" type="module"></script> | ||
<script async="" src="http://localhost:8000/v0/amp-bind-0.1.js"></script> | ||
<script async="" src="/dist/amp.js"></script> |
4 changes: 4 additions & 0 deletions
4
build-system/server/new-server/transforms/scripts/test/port-transform-loose/options.json
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 @@ | ||
{ | ||
"port": 9876, | ||
"looseScriptSrcCheck": true | ||
} |
5 changes: 5 additions & 0 deletions
5
build-system/server/new-server/transforms/scripts/test/port-transform-loose/output.html
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,5 @@ | ||
<script async="" src="http://localhost:9876/dist/amp.js"></script> | ||
<script async="" src="http://localhost:9876/dist/v0.js" nomodule=""></script> | ||
<script async="" src="http://localhost:9876/dist/v0.mjs" type="module"></script> | ||
<script async="" src="http://localhost:9876/dist/v0/amp-bind-0.1.js"></script> | ||
<script async="" src="http://localhost:9876/dist/dist/amp.js"></script> |
5 changes: 5 additions & 0 deletions
5
build-system/server/new-server/transforms/scripts/test/port-transform-strict/input.html
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,5 @@ | ||
<script async="" src="http://localhost:8000/amp.js"></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.js" nomodule=""></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.mjs" type="module"></script> | ||
<script async="" src="http://localhost:8000/v0/amp-bind-0.1.js"></script> | ||
<script async="" src="/dist/amp.js"></script> |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/scripts/test/port-transform-strict/options.json
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,3 @@ | ||
{ | ||
"port": 9876 | ||
} |
5 changes: 5 additions & 0 deletions
5
build-system/server/new-server/transforms/scripts/test/port-transform-strict/output.html
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,5 @@ | ||
<script async="" src="http://localhost:8000/amp.js"></script> | ||
<script async="" src="http://localhost:9876/dist/v0.js" nomodule=""></script> | ||
<script async="" src="http://localhost:9876/dist/v0.mjs" type="module"></script> | ||
<script async="" src="http://localhost:8000/v0/amp-bind-0.1.js"></script> | ||
<script async="" src="/dist/amp.js"></script> |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/scripts/test/retain-extension/input.html
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,3 @@ | ||
<script async="" src="https://cdn.ampproject.org/v0.js"></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.mjs"></script> | ||
<script async="" src="https://cdn.ampproject.org/v0.sxg.js"></script> |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/scripts/test/retain-extension/output.html
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,3 @@ | ||
<script async="" src="http://localhost:8000/dist/v0.js"></script> | ||
<script async="" src="http://localhost:8000/dist/v0.mjs"></script> | ||
<script async="" src="http://localhost:8000/dist/v0.sxg.js"></script> |
1 change: 1 addition & 0 deletions
1
build-system/server/new-server/transforms/scripts/test/runtime/input.html
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 +1,2 @@ | ||
<script src="https://cdn.ampproject.org/v0.js" async></script> | ||
<script src="https://cdn.ampproject.org/v0/amp-bind-0.1.js" async></script> |
1 change: 1 addition & 0 deletions
1
build-system/server/new-server/transforms/scripts/test/runtime/output.html
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 +1,2 @@ | ||
<script src="http://localhost:8000/dist/v0.js" async=""></script> | ||
<script src="http://localhost:8000/dist/v0/amp-bind-0.1.js" async=""></script> |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/scripts/test/skip-over-json-script/input.html
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,3 @@ | ||
<head> | ||
<script type="application/json">{}</script> | ||
</head> |
3 changes: 3 additions & 0 deletions
3
build-system/server/new-server/transforms/scripts/test/skip-over-json-script/output.html
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,3 @@ | ||
<head> | ||
<script type="application/json">{}</script> | ||
</head> |
44 changes: 0 additions & 44 deletions
44
build-system/server/new-server/transforms/stories/stories-transform.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.