@webqit/webflo 0.11.27 → 0.11.29
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.
package/package.json
CHANGED
|
@@ -30,8 +30,8 @@ export default class RuntimeClient {
|
|
|
30
30
|
// --------
|
|
31
31
|
// ROUTE FOR DATA
|
|
32
32
|
// --------
|
|
33
|
-
let httpMethodName = httpEvent.request.method.
|
|
34
|
-
return router.route([httpMethodName
|
|
33
|
+
let httpMethodName = httpEvent.request.method.toUpperCase();
|
|
34
|
+
return router.route([httpMethodName, 'default'], httpEvent, {}, async event => {
|
|
35
35
|
return remoteFetch(event.request);
|
|
36
36
|
}, remoteFetch);
|
|
37
37
|
};
|
|
@@ -257,12 +257,13 @@ function declareRoutesObj(gen, routesDir, targetDir, varName, routing) {
|
|
|
257
257
|
const walk = (dir, callback) => {
|
|
258
258
|
Fs.readdirSync(dir).forEach(f => {
|
|
259
259
|
let resource = Path.join(dir, f);
|
|
260
|
-
let
|
|
260
|
+
let _namespace = '/' + Path.relative(routesDir, resource).replace(/\\/g, '/');
|
|
261
|
+
let namespace = _beforeLast(_namespace, '/index.js') || '/';
|
|
261
262
|
if (Fs.statSync(resource).isDirectory()) {
|
|
262
263
|
if (routing.subroots.includes(namespace)) return;
|
|
263
264
|
walk(resource, callback);
|
|
264
265
|
} else {
|
|
265
|
-
let relativePath = Path.relative(_targetDir, resource);
|
|
266
|
+
let relativePath = Path.relative(_targetDir, resource).replace(/\\/g, '/');
|
|
266
267
|
callback(resource, namespace, relativePath);
|
|
267
268
|
}
|
|
268
269
|
});
|
|
@@ -273,7 +274,6 @@ function declareRoutesObj(gen, routesDir, targetDir, varName, routing) {
|
|
|
273
274
|
let indexCount = 0;
|
|
274
275
|
if (Fs.existsSync(_routesDir)) {
|
|
275
276
|
walk(_routesDir, (file, namespace, relativePath) => {
|
|
276
|
-
relativePath = relativePath.replace(/\\/g, '/');
|
|
277
277
|
if (relativePath.endsWith('/index.js')) {
|
|
278
278
|
// Import code
|
|
279
279
|
let routeName = 'index' + (++ indexCount);
|
|
@@ -430,6 +430,7 @@ function handleEmbeds(targetDocumentFile, embedList, unembedList) {
|
|
|
430
430
|
successLevel = 1;
|
|
431
431
|
let dom = new Jsdom.JSDOM(targetDocument), by = 'webflo', touched;
|
|
432
432
|
let embed = (src, before) => {
|
|
433
|
+
src = src.replace(/\\/g, '/');
|
|
433
434
|
let embedded = dom.window.document.querySelector(`script[src="${src}"]`);
|
|
434
435
|
if (!embedded) {
|
|
435
436
|
embedded = dom.window.document.createElement('script');
|
|
@@ -447,6 +448,7 @@ function handleEmbeds(targetDocumentFile, embedList, unembedList) {
|
|
|
447
448
|
};
|
|
448
449
|
let unembed = src => {
|
|
449
450
|
src = Path.join('/', src);
|
|
451
|
+
src = src.replace(/\\/g, '/');
|
|
450
452
|
let embedded = dom.window.document.querySelector(`script[src="${src}"][by="${by}"]`);
|
|
451
453
|
if (embedded) {
|
|
452
454
|
embedded.remove();
|
|
@@ -30,8 +30,8 @@ export default class WorkerClient {
|
|
|
30
30
|
// --------
|
|
31
31
|
// ROUTE FOR DATA
|
|
32
32
|
// --------
|
|
33
|
-
let httpMethodName = httpEvent.request.method.
|
|
34
|
-
let response = await router.route([httpMethodName
|
|
33
|
+
let httpMethodName = httpEvent.request.method.toUpperCase();
|
|
34
|
+
let response = await router.route([httpMethodName, 'default'], httpEvent, {}, async event => {
|
|
35
35
|
return remoteFetch(event.request);
|
|
36
36
|
}, remoteFetch);
|
|
37
37
|
if (!(response instanceof httpEvent.Response)) {
|
|
@@ -34,14 +34,14 @@ export default class RuntimeClient {
|
|
|
34
34
|
// --------
|
|
35
35
|
// ROUTE FOR DATA
|
|
36
36
|
// --------
|
|
37
|
-
let httpMethodName = httpEvent.request.method.
|
|
38
|
-
let response = await router.route([httpMethodName
|
|
37
|
+
let httpMethodName = httpEvent.request.method.toUpperCase();
|
|
38
|
+
let response = await router.route([httpMethodName, 'default'], httpEvent, {}, async event => {
|
|
39
39
|
return router.file(event);
|
|
40
40
|
}, remoteFetch);
|
|
41
41
|
if (!(response instanceof httpEvent.Response)) {
|
|
42
42
|
response = new httpEvent.Response(response);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
// --------
|
|
46
46
|
// Rendering
|
|
47
47
|
// --------
|