wirejs-deploy-amplify-basic 0.0.44 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -58,6 +58,17 @@ function globMatch(pattern, text) {
|
|
|
58
58
|
return regex.test(text);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
|
|
62
|
+
function toJSPath(path) {
|
|
63
|
+
if (path.endsWith('/')) {
|
|
64
|
+
return path + 'index.js';
|
|
65
|
+
} else if (!path.endsWith('.js')) {
|
|
66
|
+
return path + '.js';
|
|
67
|
+
} else {
|
|
68
|
+
return path;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
61
72
|
/**
|
|
62
73
|
*
|
|
63
74
|
* @param {http.IncomingMessage} req
|
|
@@ -77,10 +88,10 @@ function createContext(req) {
|
|
|
77
88
|
* @param {string} [forceExt]
|
|
78
89
|
*/
|
|
79
90
|
function routeSSR(context, forceExt) {
|
|
80
|
-
const asJSPath = forceExt
|
|
81
|
-
context.location.pathname
|
|
82
|
-
: context.location.pathname
|
|
83
|
-
|
|
91
|
+
const asJSPath = forceExt
|
|
92
|
+
? toJSPath(context.location.pathname)
|
|
93
|
+
: context.location.pathname;
|
|
94
|
+
|
|
84
95
|
const allHandlers = fs.readdirSync(SSR_ROOT, { recursive: true })
|
|
85
96
|
.filter(p => p.endsWith('.js'))
|
|
86
97
|
.map(p => `/${p}`)
|
|
@@ -126,7 +137,7 @@ async function trySSRScriptPath(req, res) {
|
|
|
126
137
|
async function trySSRPath(req, res) {
|
|
127
138
|
const context = createContext(req);
|
|
128
139
|
|
|
129
|
-
const asJSPath = context.location.pathname.replace(/\.(\w+)$/, '.js'
|
|
140
|
+
const asJSPath = context.location.pathname.replace(/\.(\w+)$/, '') + '.js';
|
|
130
141
|
const srcPath = routeSSR(context, 'js');
|
|
131
142
|
if (!srcPath) return false;
|
|
132
143
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wirejs-deploy-amplify-basic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"recursive-copy": "^2.0.14",
|
|
31
31
|
"rimraf": "^6.0.1",
|
|
32
32
|
"wirejs-dom": "^1.0.38",
|
|
33
|
-
"wirejs-resources": "^0.1.
|
|
33
|
+
"wirejs-resources": "^0.1.13"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@aws-amplify/backend": "^1.14.0",
|