edge-functions 2.2.0-stage.1 → 2.2.0-stage.2

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/jest.config.e2e.js +8 -0
  4. package/jest.config.unit.js +7 -0
  5. package/lib/build/bundlers/bundler-base.js +102 -0
  6. package/lib/build/bundlers/esbuild/esbuild.config.js +2 -0
  7. package/lib/build/bundlers/esbuild/index.js +46 -33
  8. package/lib/build/bundlers/esbuild/index.test.js +90 -0
  9. package/lib/build/bundlers/esbuild/plugins/node-polyfills/index.js +92 -131
  10. package/lib/build/bundlers/esbuild/plugins/node-polyfills/index.test.js +38 -0
  11. package/lib/build/bundlers/polyfills/node/_empty.js +0 -0
  12. package/lib/build/bundlers/polyfills/node/crypto.js +70 -0
  13. package/lib/build/bundlers/polyfills/node/globals/buffer.js +4 -0
  14. package/lib/build/bundlers/polyfills/node/globals/path-dirname.js +6 -0
  15. package/lib/build/{polyfills → bundlers/polyfills}/node/globals/process.js +76 -24
  16. package/lib/build/bundlers/polyfills/polyfills-manager.js +138 -0
  17. package/lib/build/bundlers/{esbuild/plugins/node-polyfills/node-pollyfills-paths.test.js → polyfills/polyfills-manager.test.js} +34 -21
  18. package/lib/build/bundlers/webpack/index.js +44 -28
  19. package/lib/build/bundlers/webpack/index.test.js +101 -0
  20. package/lib/build/bundlers/webpack/plugins/node-polyfills/index.js +65 -0
  21. package/lib/build/bundlers/webpack/plugins/node-polyfills/index.test.js +55 -0
  22. package/lib/build/bundlers/webpack/webpack.config.js +31 -2
  23. package/lib/build/dispatcher/dispatcher.js +203 -118
  24. package/lib/build/dispatcher/dispatcher.test.js +0 -1
  25. package/lib/constants/messages/build.messages.js +4 -0
  26. package/lib/presets/custom/next/compute/config.js +2 -87
  27. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/server/require.js +3 -0
  28. package/package.json +12 -5
  29. package/lib/build/bundlers/esbuild/plugins/node-polyfills/node-polyfills-paths.js +0 -122
  30. /package/lib/build/{polyfills → bundlers/polyfills}/node/dns.js +0 -0
  31. /package/lib/build/{polyfills → bundlers/polyfills}/node/fs.js +0 -0
  32. /package/lib/build/{polyfills → bundlers/polyfills}/node/globals/navigator.js +0 -0
  33. /package/lib/build/{polyfills → bundlers/polyfills}/node/globals/performance.js +0 -0
  34. /package/lib/build/{polyfills → bundlers/polyfills}/node/http2.js +0 -0
  35. /package/lib/build/{polyfills → bundlers/polyfills}/node/module.js +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "edge-functions",
3
3
  "type": "module",
4
- "version": "2.2.0-stage.1",
4
+ "version": "2.2.0-stage.2",
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": {
@@ -15,7 +15,7 @@
15
15
  "lint": "eslint .",
16
16
  "lint:fix": "eslint --fix .",
17
17
  "format": "prettier --write .",
18
- "test": "jest --clearCache && jest lib/",
18
+ "test": "jest --clearCache && jest -c jest.config.unit.js lib/",
19
19
  "test:watch": "jest lib/ --watch",
20
20
  "test:coverage": "jest --clearCache && jest lib/ --coverage",
21
21
  "format:check": "prettier . --check",
@@ -23,7 +23,7 @@
23
23
  "e2e:start": "tests/scripts/start-e2e-env.sh",
24
24
  "e2e:stop": "tests/scripts/stop-e2e-env.sh",
25
25
  "e2e:destroy": "tests/scripts/destroy-e2e-env.sh",
26
- "test:e2e": "yarn e2e:start && jest --maxWorkers 1 tests/e2e/ && yarn e2e:stop",
26
+ "test:e2e": "yarn e2e:start && jest -c jest.config.e2e.js --maxWorkers 1 tests/e2e/ && yarn e2e:stop",
27
27
  "prepare": "husky install"
28
28
  },
29
29
  "author": "aziontech",
@@ -54,6 +54,7 @@
54
54
  "chalk": "^5.3.0",
55
55
  "chokidar": "^3.5.3",
56
56
  "commander": "^10.0.1",
57
+ "console-browserify": "^1.2.0",
57
58
  "create-astro": "^3.2.2",
58
59
  "create-next-app": "^13.4.19",
59
60
  "create-react-app": "^5.0.1",
@@ -61,7 +62,7 @@
61
62
  "crypto-browserify": "^3.12.0",
62
63
  "deepmerge": "^4.3.1",
63
64
  "edge-runtime": "^2.4.5",
64
- "esbuild": "^0.18.11",
65
+ "esbuild": "^0.19.7",
65
66
  "escape-string-regexp": "^5.0.0",
66
67
  "events": "^3.3.0",
67
68
  "fast-glob": "^3.3.1",
@@ -71,6 +72,7 @@
71
72
  "inquirer": "^9.2.7",
72
73
  "install": "^0.13.0",
73
74
  "lodash": "^4.17.21",
75
+ "lodash.merge": "^4.6.2",
74
76
  "log-update": "^5.0.1",
75
77
  "mime-types": "^2.1.35",
76
78
  "npm": "^9.8.0",
@@ -79,6 +81,7 @@
79
81
  "pkg-dir": "^7.0.0",
80
82
  "process": "^0.11.10",
81
83
  "querystring-es3": "^0.2.1",
84
+ "readable-stream": "^4.4.2",
82
85
  "rollup-plugin-node-polyfills": "^0.2.1",
83
86
  "semantic-release": "^21.0.7",
84
87
  "semver": "^7.5.2",
@@ -86,9 +89,12 @@
86
89
  "stream-browserify": "^3.0.0",
87
90
  "stream-http": "^3.2.0",
88
91
  "string_decoder": "^1.3.0",
92
+ "timers-browserify": "^2.0.12",
93
+ "ts-loader": "^9.5.1",
89
94
  "tty-browserify": "^0.0.1",
90
95
  "url": "^0.11.1",
91
96
  "util": "^0.12.5",
97
+ "vm-browserify": "^1.1.2",
92
98
  "webpack": "^5.84.0",
93
99
  "webpack-merge": "^5.9.0"
94
100
  },
@@ -124,7 +130,8 @@
124
130
  "mock-fs": "^5.2.0",
125
131
  "prettier": "^3.0.3",
126
132
  "puppeteer": "^21.5.0",
127
- "supertest": "^6.3.3"
133
+ "supertest": "^6.3.3",
134
+ "tmp": "^0.2.1"
128
135
  },
129
136
  "resolutions": {
130
137
  "@babel/types": "7.22.17"
@@ -1,122 +0,0 @@
1
- // Taken from https://github.com/ionic-team/rollup-plugin-node-polyfills/blob/master/src/modules.ts
2
-
3
- import { createRequire } from 'module';
4
-
5
- const require = createRequire(import.meta.url);
6
-
7
- /**
8
- * Generates a Map composed by the module name and location
9
- * @returns {Map} - the map with module locations
10
- */
11
- function builtinsPolyfills() {
12
- const libs = new Map();
13
-
14
- libs.set(
15
- 'process',
16
- require.resolve('rollup-plugin-node-polyfills/polyfills/process-es6'),
17
- );
18
- libs.set(
19
- 'buffer',
20
- require.resolve('rollup-plugin-node-polyfills/polyfills/buffer-es6'),
21
- );
22
- libs.set(
23
- 'util',
24
- require.resolve('rollup-plugin-node-polyfills/polyfills/util'),
25
- );
26
- libs.set('sys', libs.get('util'));
27
- libs.set(
28
- 'events',
29
- require.resolve('rollup-plugin-node-polyfills/polyfills/events'),
30
- );
31
- libs.set(
32
- 'stream',
33
- require.resolve('rollup-plugin-node-polyfills/polyfills/stream'),
34
- );
35
- libs.set(
36
- 'path',
37
- require.resolve('rollup-plugin-node-polyfills/polyfills/path'),
38
- );
39
- libs.set(
40
- 'querystring',
41
- require.resolve('rollup-plugin-node-polyfills/polyfills/qs'),
42
- );
43
- libs.set(
44
- 'punycode',
45
- require.resolve('rollup-plugin-node-polyfills/polyfills/punycode'),
46
- );
47
- libs.set(
48
- 'url',
49
- require.resolve('rollup-plugin-node-polyfills/polyfills/url'),
50
- );
51
- libs.set(
52
- 'string_decoder',
53
- require.resolve('rollup-plugin-node-polyfills/polyfills/string-decoder'),
54
- );
55
- libs.set(
56
- 'http',
57
- require.resolve('rollup-plugin-node-polyfills/polyfills/http'),
58
- );
59
- libs.set(
60
- 'https',
61
- require.resolve('rollup-plugin-node-polyfills/polyfills/http'),
62
- );
63
- libs.set('os', require.resolve('rollup-plugin-node-polyfills/polyfills/os'));
64
- libs.set(
65
- 'assert',
66
- require.resolve('rollup-plugin-node-polyfills/polyfills/assert'),
67
- );
68
- libs.set(
69
- 'constants',
70
- require.resolve('rollup-plugin-node-polyfills/polyfills/constants'),
71
- );
72
- libs.set(
73
- '_stream_duplex',
74
- require.resolve(
75
- 'rollup-plugin-node-polyfills/polyfills/readable-stream/duplex',
76
- ),
77
- );
78
- libs.set(
79
- '_stream_passthrough',
80
- require.resolve(
81
- 'rollup-plugin-node-polyfills/polyfills/readable-stream/passthrough',
82
- ),
83
- );
84
- libs.set(
85
- '_stream_readable',
86
- require.resolve(
87
- 'rollup-plugin-node-polyfills/polyfills/readable-stream/readable',
88
- ),
89
- );
90
- libs.set(
91
- '_stream_writable',
92
- require.resolve(
93
- 'rollup-plugin-node-polyfills/polyfills/readable-stream/writable',
94
- ),
95
- );
96
- libs.set(
97
- '_stream_transform',
98
- require.resolve(
99
- 'rollup-plugin-node-polyfills/polyfills/readable-stream/transform',
100
- ),
101
- );
102
- libs.set(
103
- 'console',
104
- require.resolve('rollup-plugin-node-polyfills/polyfills/console'),
105
- );
106
- libs.set(
107
- 'zlib',
108
- require.resolve('rollup-plugin-node-polyfills/polyfills/zlib'),
109
- );
110
- libs.set(
111
- 'tty',
112
- require.resolve('rollup-plugin-node-polyfills/polyfills/tty'),
113
- );
114
- libs.set(
115
- 'domain',
116
- require.resolve('rollup-plugin-node-polyfills/polyfills/domain'),
117
- );
118
-
119
- return libs;
120
- }
121
-
122
- export default builtinsPolyfills;