-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feature/v4.2
- Loading branch information
Showing
107 changed files
with
12,398 additions
and
181 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ packages/*/build | |
packages/*/public | ||
packages/*/dist-cjs | ||
packages/*/dist-types | ||
__fixtures__/remote-view-fake-cdn |
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,34 @@ | ||
# RemoteView Fake ESM CDN | ||
|
||
This directory gets statically hosted by | ||
`packages/remote-view/src/__tests__/serve.js` in integration tests. The same | ||
script is also used manually to run the `remote-view-demos` package examples. | ||
|
||
## Motivation | ||
|
||
To test `<RemoteView />` locally, we need ESM views that are (a) built and (b) | ||
hosted and exposed via http. This is expensive and complicated to do on-the-fly, | ||
hence we have a small set of views/dependencies pre-built and exposed. | ||
|
||
## Contents | ||
|
||
- 4 pre-built ESM views: `esm-view-card`, `esm-view-list` (used in integration | ||
tests), `view1`, `view2` (used in demos) | ||
- React and ReactDOM at 17.0.2, exposed in the same way it would be by esm.sh | ||
(v106). This results in various dirs and files. | ||
|
||
`view1` and `view2` are built against `esm.sh`, whereas the others are built | ||
against `localhost:8484`. | ||
|
||
## Rebuilding the contents | ||
|
||
For any ESM view, you need to `yarn modular build` it, which usually requires | ||
pasting the view into the root `packages` dir temporarily. These packages can't | ||
live there permanently, as it inteferes with Modular's own tests. | ||
|
||
For ESM CDN content (React, ReactDOM etc), these must be manually downloaded and | ||
exposed into this directory using an identical structure. | ||
|
||
Sometimes, it's neccessary to tweak URLs to remove preceding slashes (inside ESM | ||
view index.html files) or add `.js` extensions (for esm.sh manually-downloaded | ||
content). |
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 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head></head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="static/js/_trampoline.js"></script> | ||
</body> | ||
</html> |
13 changes: 13 additions & 0 deletions
13
__fixtures__/remote-view-fake-cdn/esm-view-card/package.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,13 @@ | ||
{ | ||
"name": "esm-view-card", | ||
"version": "1.0.0", | ||
"modular": { | ||
"type": "esm-view", | ||
"externalCdnTemplate": "http://localhost:8484/[name]@[version]" | ||
}, | ||
"dependencies": { | ||
"react": "17.0.2" | ||
}, | ||
"bundledDependencies": [], | ||
"module": "/static/js/main.5a34a408.js" | ||
} |
5 changes: 5 additions & 0 deletions
5
__fixtures__/remote-view-fake-cdn/esm-view-card/static/js/_trampoline.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import ReactDOM from 'http://localhost:8484/react-dom@17.0.2.js'; | ||
import React from 'http://localhost:8484/react@17.0.2.js'; | ||
import Component from './main.5a34a408.js'; | ||
var DOMRoot = document.getElementById('root'); | ||
ReactDOM.render(React.createElement(Component, null), DOMRoot); |
37 changes: 37 additions & 0 deletions
37
__fixtures__/remote-view-fake-cdn/esm-view-card/static/js/main.5a34a408.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head></head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="static/js/_trampoline.js"></script> | ||
</body> | ||
</html> |
13 changes: 13 additions & 0 deletions
13
__fixtures__/remote-view-fake-cdn/esm-view-list/package.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,13 @@ | ||
{ | ||
"name": "esm-view-list", | ||
"version": "1.0.0", | ||
"modular": { | ||
"type": "esm-view", | ||
"externalCdnTemplate": "http://localhost:8484/[name]@[version]" | ||
}, | ||
"dependencies": { | ||
"react": "17.0.2" | ||
}, | ||
"bundledDependencies": [], | ||
"module": "/static/js/main.874f720c.js" | ||
} |
5 changes: 5 additions & 0 deletions
5
__fixtures__/remote-view-fake-cdn/esm-view-list/static/js/_trampoline.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import ReactDOM from 'http://localhost:8484/react-dom@17.0.2.js'; | ||
import React from 'http://localhost:8484/react@17.0.2.js'; | ||
import Component from './main.874f720c.js'; | ||
var DOMRoot = document.getElementById('root'); | ||
ReactDOM.render(React.createElement(Component, null), DOMRoot); |
41 changes: 41 additions & 0 deletions
41
__fixtures__/remote-view-fake-cdn/esm-view-list/static/js/main.874f720c.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head></head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/static/js/_trampoline.js"></script> | ||
</body> | ||
</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 @@ | ||
/* esm.sh - react-dom@17.0.2 */ | ||
export * from 'http://localhost:8484/v106/react-dom@17.0.2/es2022/react-dom.js'; | ||
export { default } from 'http://localhost:8484/v106/react-dom@17.0.2/es2022/react-dom.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* esm.sh - react@17.0.2 */ | ||
export * from 'http://localhost:8484/stable/react@17.0.2/es2022/react.js'; | ||
export { default } from 'http://localhost:8484/stable/react@17.0.2/es2022/react.js'; |
Oops, something went wrong.