edge-functions 2.7.0 → 2.7.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ### [2.7.1](https://github.com/aziontech/vulcan/compare/v2.7.0...v2.7.1) (2024-05-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * process env support at runtime ([#323](https://github.com/aziontech/vulcan/issues/323)) ([2a5c055](https://github.com/aziontech/vulcan/commit/2a5c055eaec220c32f319e97a0c6e2e462fea409))
7
+
8
+ ### [2.7.1-stage.1](https://github.com/aziontech/vulcan/compare/v2.7.0...v2.7.1-stage.1) (2024-05-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * process env support at runtime ([#323](https://github.com/aziontech/vulcan/issues/323)) ([2a5c055](https://github.com/aziontech/vulcan/commit/2a5c055eaec220c32f319e97a0c6e2e462fea409))
14
+
1
15
  ## [2.7.0](https://github.com/aziontech/vulcan/compare/v2.6.2...v2.7.0) (2024-05-07)
2
16
 
3
17
 
package/README.md CHANGED
@@ -40,7 +40,7 @@ Table:
40
40
  | Simple Js Esm | ✅ |
41
41
  | Simple Ts Esm | ✅ |
42
42
 
43
- Last test run date: 05/07/24 02:56:50 AM
43
+ Last test run date: 05/08/24 02:51:13 AM
44
44
  ## Quick Installation
45
45
 
46
46
  For those who just want to use Vulcan in their project without contributing to the development, you can install it directly from npm.
@@ -213,11 +213,11 @@ module.exports = {
213
213
  - [Overview](docs/overview.md)
214
214
  - [Presets](docs/presets.md)
215
215
  - [Nextjs](docs/nextjs.md)
216
- - [Rust/Wasm example](examples/rust-wasm-yew-ssr/)
217
- - [Emscripten/Wasm example](examples/emscripten-wasm/)
218
- - [Env vars example](examples/simple-js-env-vars)
219
- - [Storage example](examples/simple-js-esm-storage)
220
- - [Firewall example](examples/simple-js-firewall-event)
216
+ - [Rust/Wasm example](https://github.com/aziontech/vulcan-examples/tree/main/examples/rust-wasm-yew-ssr/)
217
+ - [Emscripten/Wasm example](https://github.com/aziontech/vulcan-examples/tree/main/examples/emscripten-wasm/)
218
+ - [Env vars example](https://github.com/aziontech/vulcan-examples/tree/main/examples/javascript/simple-js-env-vars)
219
+ - [Storage example](https://github.com/aziontech/vulcan-examples/tree/main/examples/javascript/simple-js-esm-storage)
220
+ - [Firewall example](https://github.com/aziontech/vulcan-examples/tree/main/examples/javascript/simple-js-firewall-event)
221
221
 
222
222
  ## Wasm Notes
223
223
 
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  // shim for using process in browser
3
- var process = (module.exports = {});
3
+ var processShim = (module.exports = {});
4
4
 
5
5
  /*
6
6
  * Copyright Azion
@@ -137,7 +137,7 @@ function drainQueue() {
137
137
  runClearTimeout(timeout);
138
138
  }
139
139
 
140
- process.nextTick = function (fun) {
140
+ processShim.nextTick = function (fun) {
141
141
  var args = new Array(arguments.length - 1);
142
142
  if (arguments.length > 1) {
143
143
  for (var i = 1; i < arguments.length; i++) {
@@ -158,43 +158,46 @@ function Item(fun, array) {
158
158
  Item.prototype.run = function () {
159
159
  this.fun.apply(null, this.array);
160
160
  };
161
- process.title = 'browser';
162
- process.browser = true;
163
- process.env = {};
164
- process.argv = [];
165
- process.version = ''; // empty string to avoid regexp issues
166
- process.versions = { node: '18.3.1' };
161
+ processShim.title = 'browser';
162
+ processShim.browser = true;
163
+ processShim.env = processShim.env =
164
+ typeof globalThis.process !== 'undefined' && globalThis.process.env
165
+ ? globalThis.process.env
166
+ : {};
167
+ processShim.argv = [];
168
+ processShim.version = ''; // empty string to avoid regexp issues
169
+ processShim.versions = { node: '18.3.1' };
167
170
 
168
171
  function noop() {}
169
172
 
170
- process.on = noop;
171
- process.addListener = noop;
172
- process.once = noop;
173
- process.off = noop;
174
- process.removeListener = noop;
175
- process.removeAllListeners = noop;
176
- process.emit = noop;
177
- process.prependListener = noop;
178
- process.prependOnceListener = noop;
173
+ processShim.on = noop;
174
+ processShim.addListener = noop;
175
+ processShim.once = noop;
176
+ processShim.off = noop;
177
+ processShim.removeListener = noop;
178
+ processShim.removeAllListeners = noop;
179
+ processShim.emit = noop;
180
+ processShim.prependListener = noop;
181
+ processShim.prependOnceListener = noop;
179
182
 
180
- process.listeners = function (name) {
183
+ processShim.listeners = function (name) {
181
184
  return [];
182
185
  };
183
186
 
184
- process.binding = function (name) {
187
+ processShim.binding = function (name) {
185
188
  throw new Error('process.binding is not supported');
186
189
  };
187
190
 
188
- process.cwd = function () {
191
+ processShim.cwd = function () {
189
192
  return '/';
190
193
  };
191
194
 
192
- process.chdir = function (dir) {
195
+ processShim.chdir = function (dir) {
193
196
  throw new Error('process.chdir is not supported');
194
197
  };
195
- process.umask = function () {
198
+ processShim.umask = function () {
196
199
  return 0;
197
200
  };
198
201
 
199
- globalThis.process = process;
200
- globalThis.process.env ??= {};
202
+ globalThis.process = processShim;
203
+ globalThis.process.env = processShim.env;
@@ -173,9 +173,19 @@ describe('Utils - generateManifest', () => {
173
173
  const result = processManifestConfig(azionConfig);
174
174
  expect(result.rules[0].behaviors).toEqual(
175
175
  expect.arrayContaining([
176
+ expect.objectContaining({
177
+ name: 'capture_match_groups',
178
+ target: expect.objectContaining({
179
+ captured_array: 'other',
180
+ regex: '^(./)([^/])$',
181
+ // eslint-disable-next-line no-template-curly-in-string
182
+ subject: '${uri}',
183
+ }),
184
+ }),
176
185
  expect.objectContaining({
177
186
  name: 'rewrite_request',
178
- target: expect.stringContaining('/%{other[0]}/%{other[1]}'), // Updated from 'params' to 'target'
187
+ // eslint-disable-next-line no-template-curly-in-string
188
+ target: '/${other[0]}/${other[1]}',
179
189
  }),
180
190
  ]),
181
191
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "edge-functions",
3
3
  "type": "module",
4
- "version": "2.7.0",
4
+ "version": "2.7.1",
5
5
  "description": "Tool to launch and build JavaScript/Frameworks. This tool automates polyfills for Edge Computing and assists in creating Workers, notably for the Azion platform.",
6
6
  "main": "lib/main.js",
7
7
  "bin": {