Skip to content
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

followup pull request #1686

Merged
merged 8 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/subapp-server/lib/fastify-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
request
});

const data = context.result;
const data = context.result;
const status = data.status;

if (data instanceof Error) {
Expand Down
5 changes: 2 additions & 3 deletions packages/subapp-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
],
"dependencies": {
"@hapi/boom": "^7.4.1",
"@xarc/webapp": "../../packages/xarc-webapp",
"@xarc/jsx-renderer": "^1.0.0",
"@xarc/webapp": "^1.0.0",
"filter-scan-dir": "^1.0.9",
"http-status-codes": "^1.3.0",
"optional-require": "^1.0.0",
Expand All @@ -49,7 +48,7 @@
},
"fyn": {
"dependencies": {
"@xarc/webapp": "../../packages/xarc-webapp",
"@xarc/webapp": "../xarc-webapp",
"subapp-util": "../subapp-util",
"@xarc/jsx-renderer": "../xarc-jsx-renderer"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/xarc-jsx-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"trailingComma": "none"
},
"dependencies": {
"@xarc/render-context": "../xarc-render-context",
"@xarc/render-context": "^1.0.0",
"lodash": "^4.17.15",
"munchy": "^1.0.7",
"optional-require": "^1.0.0",
Expand Down
7 changes: 1 addition & 6 deletions packages/xarc-jsx-renderer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,5 @@
"strictFunctionTypes": true,
"jsx": "react"
},
"include": [
"src",
"../xarc-render-context/src/symbols.ts",
"../xarc-render-context/src/TokenModule.ts",
"../xarc-render-context/src/load-handler.ts"
]
"include": ["src"]
}
7 changes: 6 additions & 1 deletion packages/xarc-simple-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"typedoc": "^0.17.4",
"typescript": "^3.8.3",
"xstdout": "^0.1.1",
"@xarc/render-context": "../../packages/xarc-render-context"
"@xarc/render-context": "^1.0.0"
},
"mocha": {
"require": [
Expand Down Expand Up @@ -79,5 +79,10 @@
"functions": 100,
"lines": 100,
"cache": false
},
"fyn": {
"devDependencies": {
"@xarc/render-context": "../xarc-render-context"
}
}
}
6 changes: 3 additions & 3 deletions packages/xarc-webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"webapp"
],
"dependencies": {
"@xarc/jsx-renderer": "file:../xarc-jsx-renderer",
"@xarc/jsx-renderer": "^1.0.0",
"@xarc/module-dev": "^2.1.1",
"@xarc/render-context": "file:../xarc-render-context",
"@xarc/simple-renderer": "file:../xarc-simple-renderer",
"@xarc/render-context": "^1.0.0",
"@xarc/simple-renderer": "^1.0.0",
"ts-node": "^8.10.2",
"typescript": "^3.9.5",
"xclap": "^0.2.51",
Expand Down
2 changes: 1 addition & 1 deletion packages/xarc-webapp/src/webapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function initializeTemplate(
asyncTemplate.initializeRenderer();
} else {
const templateFullPath = resolvePath(tmplFile);
const template = resolvePath(tmplFile);
const template = require(templateFullPath);
asyncTemplate = new JsxRenderer({
templateFullPath: Path.dirname(templateFullPath),
template: _.get(template, "default", template),
Expand Down
3 changes: 3 additions & 0 deletions packages/xarc-webapp/test/data/bad-content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* eslint-disable */

require("foo-blah");
32 changes: 32 additions & 0 deletions packages/xarc-webapp/test/data/chunk-selector.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use strict";

const FOO_BUNDLE = {
css: "foo",
js: "foo"
};
const BAR_BUNDLE = {
css: "bar",
js: "bar"
};
const DEFAULT_BUNDLE = {
css: "home",
js: "home"
};
const MULTI_BUNDLE = {
css: ["foo", "bar"],
js: "home"
};

module.exports = request => {
if (request.path.endsWith("/foo")) {
return FOO_BUNDLE;
} else if (request.path.endsWith("/bar")) {
return BAR_BUNDLE;
} else if (request.path.endsWith("/multi-chunk")) {
return MULTI_BUNDLE;
} else if (request.path.endsWith("/empty")) {
return {};
}

return DEFAULT_BUNDLE;
};
3 changes: 3 additions & 0 deletions packages/xarc-webapp/test/data/critical.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
color: green;
}
1 change: 1 addition & 0 deletions packages/xarc-webapp/test/data/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "hello";
3 changes: 3 additions & 0 deletions packages/xarc-webapp/test/data/icon-stats-empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"empty": true
}
7 changes: 7 additions & 0 deletions packages/xarc-webapp/test/data/icon-stats-test-pwa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"html": [
"<meta name=\"mobile-web-app-capable\" content=\"yes\">",
"<meta name=\"application-name\" content=\"Electrode\">",
"<link rel=\"icon\" href=\"\/js\/favicon-32x32.png\">"
]
}
38 changes: 38 additions & 0 deletions packages/xarc-webapp/test/data/index-1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--%{INITIALIZE}-->
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--%{META_TAGS}-->
<!--%{PAGE_TITLE}-->
<!--%{CRITICAL_CSS}-->
<!--%{WEBAPP_HEADER_BUNDLES}-->
<!--%{ user-header-token }-->
</head>

<body>
<div>test html-1</div>
<!--%{user-spot-token}-->
<div class="js-content">
<!--%{user-token-unhandled}-->
<!--%{SSR_CONTENT}-->
</div>
<!--%{PREFETCH_BUNDLES}-->
<!--%{user-promise-token}-->
<!--%{WEBAPP_BODY_BUNDLES}-->
<script>
if (window.webappStart) webappStart();
</script>
<!--%{#../fixtures/custom-1}-->
<!--%{user-token-1}-->
<!--%{user-token-2}-->
<noscript>
<h4>JavaScript is Disabled</h4>
<p>Sorry, this webpage requires JavaScript to function correctly.</p>
<p>Please enable JavaScript in your browser and reload the page.</p>
</noscript>
</body>

</html>
32 changes: 32 additions & 0 deletions packages/xarc-webapp/test/data/index-2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--%{INITIALIZE}-->
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--%{INITIALIZE_HELMET}-->
<!--%{META_TAGS}-->
<!--%{PAGE_TITLE}-->
<!--%{CRITICAL_CSS}-->
<!--%{WEBAPP_HEADER_BUNDLES}-->
</head>

<body>
<div>test html-2</div>
<div class="js-content">
<!--%{SSR_CONTENT}-->
</div>
<!--%{PREFETCH_BUNDLES}-->
<!--%{WEBAPP_BODY_BUNDLES}-->
<script>
if (window.webappStart) webappStart();
</script>
<noscript>
<h4>JavaScript is Disabled</h4>
<p>Sorry, this webpage requires JavaScript to function correctly.</p>
<p>Please enable JavaScript in your browser and reload the page.</p>
</noscript>
</body>

</html>
40 changes: 40 additions & 0 deletions packages/xarc-webapp/test/data/perf-1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<!--%{INITIALIZE}-->
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--%{META_TAGS}-->
<!--%{PAGE_TITLE}-->
<!--%{CRITICAL_CSS}-->
<!--%{WEBAPP_HEADER_BUNDLES}-->
</head>
<!--%{HEAD_CLOSED}-->

<body>
<div>test perf 1 html</div>
<!--%{user-spot-token}-->
<div class="js-content">
<!--%{SSR_CONTENT}-->
</div>
<!--%{AFTER_SSR_CONTENT}-->
<!--%{PREFETCH_BUNDLES}-->
<!--%{user-promise-token}-->
<!--%{WEBAPP_BODY_BUNDLES}-->
<script>
if (window.webappStart) webappStart();
</script>
<!--%{#../fixtures/custom-1}-->
<!--%{user-token-1}-->
<!--%{user-token-2}-->
<noscript>
<h4>JavaScript is Disabled</h4>
<p>Sorry, this webpage requires JavaScript to function correctly.</p>
<p>Please enable JavaScript in your browser and reload the page.</p>
</noscript>
</body>
<!--%{BODY_CLOSED}-->

</html>
<!--%{HTML_CLOSED}-->
71 changes: 71 additions & 0 deletions packages/xarc-webapp/test/data/stats-test-multibundle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"assetsByChunkName": {
"foo": [
"foo.bundle.f07a873ce87fc904a6a5.js",
"foo.style.f07a873ce87fc904a6a5.css"
],
"bar": [
"bar.bundle.f07a873ce87fc904a6a5.js",
"bar.style.f07a873ce87fc904a6a5.css"
],
"home": [
"home.bundle.f07a873ce87fc904a6a5.js",
"home.style.f07a873ce87fc904a6a5.css"
]
},
"assets": [{
"name": "foo.style.f07a873ce87fc904a6a5.css",
"size": 888,
"chunks": [
0
],
"chunkNames": [
"foo"
]
}, {
"name": "foo.bundle.f07a873ce87fc904a6a5.js",
"size": 888,
"chunks": [
0
],
"chunkNames": [
"foo"
]
}, {
"name": "bar.style.f07a873ce87fc904a6a5.css",
"size": 888,
"chunks": [
0
],
"chunkNames": [
"bar"
]
}, {
"name": "bar.bundle.f07a873ce87fc904a6a5.js",
"size": 888,
"chunks": [
0
],
"chunkNames": [
"bar"
]
}, {
"name": "home.style.f07a873ce87fc904a6a5.css",
"size": 888,
"chunks": [
0
],
"chunkNames": [
"home"
]
}, {
"name": "home.bundle.f07a873ce87fc904a6a5.js",
"size": 888,
"chunks": [
0
],
"chunkNames": [
"home"
]
}]
}
27 changes: 27 additions & 0 deletions packages/xarc-webapp/test/data/stats-test-one-bundle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"assetsByChunkName": {
"bundle": [
"bundle.f07a873ce87fc904a6a5.js",
"style.f07a873ce87fc904a6a5.css"
]
},
"assets": [{
"name": "style.f07a873ce87fc904a6a5.css",
"size": 888,
"chunks": [
0
],
"chunkNames": [
"main"
]
}, {
"name": "bundle.f07a873ce87fc904a6a5.js",
"size": 888,
"chunks": [
0
],
"chunkNames": [
"main"
]
}]
}
36 changes: 36 additions & 0 deletions packages/xarc-webapp/test/data/stats-test-pwa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"assetsByChunkName": {
"bundle": [
"bundle.f07a873ce87fc904a6a5.js",
"style.f07a873ce87fc904a6a5.css"
],
"bar": [
"bar.bundle.f07a873ce87fc904a6a5.js",
"bar.style.f07a873ce87fc904a6a5.css"
]
},
"assets": [{
"name": "style.f07a873ce87fc904a6a5.css",
"size": 888,
"chunks": [
0
],
"chunkNames": [
"bundle"
]
}, {
"name": "bundle.f07a873ce87fc904a6a5.js",
"size": 888,
"chunks": [
0
],
"chunkNames": [
"bundle"
]
}, {
"name": "manifest.json",
"size": 888,
"chunks": [],
"chunkNames": []
}]
}
Loading