lucid-package 0.0.61 → 0.0.62
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 +1 -1
- package/src/cors.d.ts +1 -0
- package/src/cors.js +13 -0
- package/src/editorextension.js +2 -5
- package/src/shapelibrary.js +2 -5
package/package.json
CHANGED
package/src/cors.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function corsAllowLucid(req: any, res: any, next: () => void): void;
|
package/src/cors.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.corsAllowLucid = void 0;
|
|
4
|
+
function corsAllowLucid(req, res, next) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
if ((_b = (_a = req.headers) === null || _a === void 0 ? void 0 : _a.origin) === null || _b === void 0 ? void 0 : _b.match(/.lucid(dev|staging|).app$/)) {
|
|
7
|
+
res.header('Access-Control-Allow-Origin', req.headers.origin);
|
|
8
|
+
res.header('Vary', 'Origin');
|
|
9
|
+
res.header('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
|
10
|
+
}
|
|
11
|
+
next();
|
|
12
|
+
}
|
|
13
|
+
exports.corsAllowLucid = corsAllowLucid;
|
package/src/editorextension.js
CHANGED
|
@@ -6,6 +6,7 @@ const express = require("express");
|
|
|
6
6
|
const oldFs = require("fs");
|
|
7
7
|
const fs = require("fs/promises");
|
|
8
8
|
const path = require("path");
|
|
9
|
+
const cors_1 = require("./cors");
|
|
9
10
|
const filesystemutil_1 = require("./filesystemutil");
|
|
10
11
|
const package_1 = require("./package");
|
|
11
12
|
const packagemanifest_1 = require("./packagemanifest");
|
|
@@ -98,11 +99,7 @@ async function debugEditorExtension(extensionNames, quiet = false, pickAnyPort =
|
|
|
98
99
|
return child;
|
|
99
100
|
}));
|
|
100
101
|
const app = express();
|
|
101
|
-
app.use(
|
|
102
|
-
res.header('Access-Control-Allow-Origin', '*');
|
|
103
|
-
res.header('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
|
104
|
-
next();
|
|
105
|
-
});
|
|
102
|
+
app.use(cors_1.corsAllowLucid);
|
|
106
103
|
app.get(['/extension.js', '/editorextension/:name/extension.js'], async (req, res) => {
|
|
107
104
|
var _a;
|
|
108
105
|
const name = (_a = req.params['name']) !== null && _a !== void 0 ? _a : extensionNames[0];
|
package/src/shapelibrary.js
CHANGED
|
@@ -6,6 +6,7 @@ const fsSync = require("fs");
|
|
|
6
6
|
const fs = require("fs/promises");
|
|
7
7
|
const JSZip = require("jszip");
|
|
8
8
|
const path = require("path");
|
|
9
|
+
const cors_1 = require("./cors");
|
|
9
10
|
const filesystemutil_1 = require("./filesystemutil");
|
|
10
11
|
const package_1 = require("./package");
|
|
11
12
|
const packagemanifest_1 = require("./packagemanifest");
|
|
@@ -255,11 +256,7 @@ exports.buildShapeLibrary = buildShapeLibrary;
|
|
|
255
256
|
async function debugShapeLibraries(packagePath = '.', pickAnyPort = false) {
|
|
256
257
|
let port = 9901;
|
|
257
258
|
const app = express();
|
|
258
|
-
app.use(
|
|
259
|
-
res.header('Access-Control-Allow-Origin', '*');
|
|
260
|
-
res.header('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
|
261
|
-
next();
|
|
262
|
-
});
|
|
259
|
+
app.use(cors_1.corsAllowLucid);
|
|
263
260
|
//Having a version number on the shape library URL that changes each time the user updates the code
|
|
264
261
|
//allows us to refresh the toolbox in the editor mid-editor-session. Unless the URL changes for the
|
|
265
262
|
//shape library, the toolbox doesn't update.
|