netlify-cli 8.14.1 → 8.16.0-rc-eh
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/npm-shrinkwrap.json +78 -126
- package/package.json +6 -5
- package/src/commands/deploy/deploy.js +0 -7
- package/src/commands/functions/functions-invoke.js +17 -2
- package/src/functions-templates/javascript/stripe-charge/package-lock.json +7 -7
- package/src/functions-templates/javascript/stripe-subscription/package-lock.json +7 -7
- package/src/functions-templates/rust/hello-world/Cargo.toml +1 -1
- package/src/lib/edge-handlers/index.js +23 -0
- package/src/lib/functions/netlify-function.js +9 -1
- package/src/lib/functions/runtimes/js/builders/zisi.js +28 -6
- package/src/lib/functions/runtimes/js/index.js +2 -1
- package/src/lib/functions/scheduled.js +98 -0
- package/src/lib/functions/server.js +10 -0
- package/src/utils/deploy/deploy-site.js +26 -4
- package/src/utils/deploy/hash-files.js +12 -7
- package/src/utils/deploy/hasher-segments.js +10 -2
- package/src/utils/functions/constants.js +5 -0
- package/src/utils/functions/get-functions.js +5 -3
- package/src/utils/functions/index.js +4 -1
- package/src/utils/functions/edge-handlers.js +0 -88
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.16.0-rc-eh",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "netlify-cli",
|
|
9
|
-
"version": "8.
|
|
9
|
+
"version": "8.16.0-rc-eh",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@sindresorhus/slugify": "^1.1.0",
|
|
23
23
|
"ansi-escapes": "^5.0.0",
|
|
24
24
|
"ansi-styles": "^5.0.0",
|
|
25
|
+
"ansi2html": "^0.0.1",
|
|
25
26
|
"ascii-table": "0.0.9",
|
|
26
27
|
"backoff": "^2.5.0",
|
|
27
28
|
"better-opn": "^3.0.0",
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
"content-type": "^1.0.4",
|
|
37
38
|
"cookie": "^0.4.0",
|
|
38
39
|
"copy-template-dir": "^1.4.0",
|
|
40
|
+
"cron-parser": "^4.2.1",
|
|
39
41
|
"debug": "^4.1.1",
|
|
40
42
|
"decache": "^4.6.0",
|
|
41
43
|
"del": "^6.0.0",
|
|
@@ -134,7 +136,6 @@
|
|
|
134
136
|
"ini": "^2.0.0",
|
|
135
137
|
"jsonwebtoken": "^8.5.1",
|
|
136
138
|
"mock-fs": "^5.1.2",
|
|
137
|
-
"mock-require": "^3.0.3",
|
|
138
139
|
"p-timeout": "^4.0.0",
|
|
139
140
|
"proxyquire": "^2.1.3",
|
|
140
141
|
"seedrandom": "^3.0.5",
|
|
@@ -147,7 +148,7 @@
|
|
|
147
148
|
"tomlify-j0.4": "^3.0.0",
|
|
148
149
|
"tree-kill": "^1.2.2",
|
|
149
150
|
"typescript": "^4.4.4",
|
|
150
|
-
"verdaccio": "^5.
|
|
151
|
+
"verdaccio": "^5.5.2"
|
|
151
152
|
},
|
|
152
153
|
"engines": {
|
|
153
154
|
"node": "^12.20.0 || ^14.14.0 || >=16.0.0"
|
|
@@ -4052,18 +4053,6 @@
|
|
|
4052
4053
|
"url": "https://opencollective.com/verdaccio"
|
|
4053
4054
|
}
|
|
4054
4055
|
},
|
|
4055
|
-
"node_modules/@verdaccio/readme/node_modules/marked": {
|
|
4056
|
-
"version": "4.0.10",
|
|
4057
|
-
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.10.tgz",
|
|
4058
|
-
"integrity": "sha512-+QvuFj0nGgO970fySghXGmuw+Fd0gD2x3+MqCWLIPf5oxdv1Ka6b2q+z9RP01P/IaKPMEramy+7cNy/Lw8c3hw==",
|
|
4059
|
-
"dev": true,
|
|
4060
|
-
"bin": {
|
|
4061
|
-
"marked": "bin/marked.js"
|
|
4062
|
-
},
|
|
4063
|
-
"engines": {
|
|
4064
|
-
"node": ">= 12"
|
|
4065
|
-
}
|
|
4066
|
-
},
|
|
4067
4056
|
"node_modules/@verdaccio/streams": {
|
|
4068
4057
|
"version": "10.1.0",
|
|
4069
4058
|
"resolved": "https://registry.npmjs.org/@verdaccio/streams/-/streams-10.1.0.tgz",
|
|
@@ -4079,14 +4068,10 @@
|
|
|
4079
4068
|
}
|
|
4080
4069
|
},
|
|
4081
4070
|
"node_modules/@verdaccio/ui-theme": {
|
|
4082
|
-
"version": "6.0.0-6-next.
|
|
4083
|
-
"resolved": "https://registry.npmjs.org/@verdaccio/ui-theme/-/ui-theme-6.0.0-6-next.
|
|
4084
|
-
"integrity": "sha512-
|
|
4085
|
-
"dev": true
|
|
4086
|
-
"engines": {
|
|
4087
|
-
"node": ">=14",
|
|
4088
|
-
"npm": ">=6"
|
|
4089
|
-
}
|
|
4071
|
+
"version": "6.0.0-6-next.16",
|
|
4072
|
+
"resolved": "https://registry.npmjs.org/@verdaccio/ui-theme/-/ui-theme-6.0.0-6-next.16.tgz",
|
|
4073
|
+
"integrity": "sha512-FbYl3273qaA0/fRwrvE876/HuvU81zjsnR70rCEojBelDuddl3xbY1LVdvthCjUGuIj2SUNpTzGhyROdqHJUCg==",
|
|
4074
|
+
"dev": true
|
|
4090
4075
|
},
|
|
4091
4076
|
"node_modules/abab": {
|
|
4092
4077
|
"version": "2.0.5",
|
|
@@ -4426,6 +4411,17 @@
|
|
|
4426
4411
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
|
4427
4412
|
}
|
|
4428
4413
|
},
|
|
4414
|
+
"node_modules/ansi2html": {
|
|
4415
|
+
"version": "0.0.1",
|
|
4416
|
+
"resolved": "https://registry.npmjs.org/ansi2html/-/ansi2html-0.0.1.tgz",
|
|
4417
|
+
"integrity": "sha1-u4gARhtECvALkb89c2al4LhHO6g=",
|
|
4418
|
+
"bin": {
|
|
4419
|
+
"ansi2html": "bin/ansi2html"
|
|
4420
|
+
},
|
|
4421
|
+
"engines": {
|
|
4422
|
+
"node": ">0.4"
|
|
4423
|
+
}
|
|
4424
|
+
},
|
|
4429
4425
|
"node_modules/any-observable": {
|
|
4430
4426
|
"version": "0.3.0",
|
|
4431
4427
|
"resolved": "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz",
|
|
@@ -10887,12 +10883,6 @@
|
|
|
10887
10883
|
"node": ">=6.0"
|
|
10888
10884
|
}
|
|
10889
10885
|
},
|
|
10890
|
-
"node_modules/get-caller-file": {
|
|
10891
|
-
"version": "1.0.3",
|
|
10892
|
-
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
|
|
10893
|
-
"integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==",
|
|
10894
|
-
"dev": true
|
|
10895
|
-
},
|
|
10896
10886
|
"node_modules/get-intrinsic": {
|
|
10897
10887
|
"version": "1.1.1",
|
|
10898
10888
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
|
|
@@ -14270,15 +14260,15 @@
|
|
|
14270
14260
|
}
|
|
14271
14261
|
},
|
|
14272
14262
|
"node_modules/marked": {
|
|
14273
|
-
"version": "
|
|
14274
|
-
"resolved": "https://registry.npmjs.org/marked/-/marked-
|
|
14275
|
-
"integrity": "sha512
|
|
14263
|
+
"version": "4.0.10",
|
|
14264
|
+
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.10.tgz",
|
|
14265
|
+
"integrity": "sha512-+QvuFj0nGgO970fySghXGmuw+Fd0gD2x3+MqCWLIPf5oxdv1Ka6b2q+z9RP01P/IaKPMEramy+7cNy/Lw8c3hw==",
|
|
14276
14266
|
"dev": true,
|
|
14277
14267
|
"bin": {
|
|
14278
|
-
"marked": "bin/marked"
|
|
14268
|
+
"marked": "bin/marked.js"
|
|
14279
14269
|
},
|
|
14280
14270
|
"engines": {
|
|
14281
|
-
"node": ">=
|
|
14271
|
+
"node": ">= 12"
|
|
14282
14272
|
}
|
|
14283
14273
|
},
|
|
14284
14274
|
"node_modules/matcher": {
|
|
@@ -14770,31 +14760,6 @@
|
|
|
14770
14760
|
"node": ">=12.0.0"
|
|
14771
14761
|
}
|
|
14772
14762
|
},
|
|
14773
|
-
"node_modules/mock-require": {
|
|
14774
|
-
"version": "3.0.3",
|
|
14775
|
-
"resolved": "https://registry.npmjs.org/mock-require/-/mock-require-3.0.3.tgz",
|
|
14776
|
-
"integrity": "sha512-lLzfLHcyc10MKQnNUCv7dMcoY/2Qxd6wJfbqCcVk3LDb8An4hF6ohk5AztrvgKhJCqj36uyzi/p5se+tvyD+Wg==",
|
|
14777
|
-
"dev": true,
|
|
14778
|
-
"dependencies": {
|
|
14779
|
-
"get-caller-file": "^1.0.2",
|
|
14780
|
-
"normalize-path": "^2.1.1"
|
|
14781
|
-
},
|
|
14782
|
-
"engines": {
|
|
14783
|
-
"node": ">=4.3.0"
|
|
14784
|
-
}
|
|
14785
|
-
},
|
|
14786
|
-
"node_modules/mock-require/node_modules/normalize-path": {
|
|
14787
|
-
"version": "2.1.1",
|
|
14788
|
-
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
|
|
14789
|
-
"integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
|
|
14790
|
-
"dev": true,
|
|
14791
|
-
"dependencies": {
|
|
14792
|
-
"remove-trailing-separator": "^1.0.1"
|
|
14793
|
-
},
|
|
14794
|
-
"engines": {
|
|
14795
|
-
"node": ">=0.10.0"
|
|
14796
|
-
}
|
|
14797
|
-
},
|
|
14798
14763
|
"node_modules/module-definition": {
|
|
14799
14764
|
"version": "3.3.1",
|
|
14800
14765
|
"resolved": "https://registry.npmjs.org/module-definition/-/module-definition-3.3.1.tgz",
|
|
@@ -21056,16 +21021,16 @@
|
|
|
21056
21021
|
}
|
|
21057
21022
|
},
|
|
21058
21023
|
"node_modules/verdaccio": {
|
|
21059
|
-
"version": "5.5.
|
|
21060
|
-
"resolved": "https://registry.npmjs.org/verdaccio/-/verdaccio-5.5.
|
|
21061
|
-
"integrity": "sha512-
|
|
21024
|
+
"version": "5.5.2",
|
|
21025
|
+
"resolved": "https://registry.npmjs.org/verdaccio/-/verdaccio-5.5.2.tgz",
|
|
21026
|
+
"integrity": "sha512-SU107gfxE8FLrwp5GezhmWE0otWTAb7xIcz/m931vqOPjeH2MwbMf0+WuCDQ5O80XxdwurlK/JFNRYzDzqUrMA==",
|
|
21062
21027
|
"dev": true,
|
|
21063
21028
|
"dependencies": {
|
|
21064
21029
|
"@verdaccio/commons-api": "10.1.0",
|
|
21065
21030
|
"@verdaccio/local-storage": "10.1.1",
|
|
21066
21031
|
"@verdaccio/readme": "10.2.1",
|
|
21067
21032
|
"@verdaccio/streams": "10.1.0",
|
|
21068
|
-
"@verdaccio/ui-theme": "6.0.0-6-next.
|
|
21033
|
+
"@verdaccio/ui-theme": "6.0.0-6-next.16",
|
|
21069
21034
|
"async": "3.2.3",
|
|
21070
21035
|
"body-parser": "1.19.1",
|
|
21071
21036
|
"clipanion": "3.1.0",
|
|
@@ -21088,9 +21053,9 @@
|
|
|
21088
21053
|
"lodash": "4.17.21",
|
|
21089
21054
|
"lru-cache": "6.0.0",
|
|
21090
21055
|
"lunr-mutable-indexes": "2.3.2",
|
|
21091
|
-
"marked": "
|
|
21056
|
+
"marked": "4.0.10",
|
|
21092
21057
|
"memoizee": "0.4.15",
|
|
21093
|
-
"mime": "
|
|
21058
|
+
"mime": "3.0.0",
|
|
21094
21059
|
"minimatch": "3.0.4",
|
|
21095
21060
|
"mkdirp": "1.0.4",
|
|
21096
21061
|
"mv": "2.1.1",
|
|
@@ -21181,15 +21146,15 @@
|
|
|
21181
21146
|
}
|
|
21182
21147
|
},
|
|
21183
21148
|
"node_modules/verdaccio/node_modules/mime": {
|
|
21184
|
-
"version": "
|
|
21185
|
-
"resolved": "https://registry.npmjs.org/mime/-/mime-
|
|
21186
|
-
"integrity": "sha512-
|
|
21149
|
+
"version": "3.0.0",
|
|
21150
|
+
"resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
|
|
21151
|
+
"integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
|
|
21187
21152
|
"dev": true,
|
|
21188
21153
|
"bin": {
|
|
21189
21154
|
"mime": "cli.js"
|
|
21190
21155
|
},
|
|
21191
21156
|
"engines": {
|
|
21192
|
-
"node": ">=
|
|
21157
|
+
"node": ">=10.0.0"
|
|
21193
21158
|
}
|
|
21194
21159
|
},
|
|
21195
21160
|
"node_modules/verdaccio/node_modules/mkdirp": {
|
|
@@ -21469,9 +21434,9 @@
|
|
|
21469
21434
|
}
|
|
21470
21435
|
},
|
|
21471
21436
|
"node_modules/winston": {
|
|
21472
|
-
"version": "3.
|
|
21473
|
-
"resolved": "https://registry.npmjs.org/winston/-/winston-3.
|
|
21474
|
-
"integrity": "sha512-
|
|
21437
|
+
"version": "3.5.0",
|
|
21438
|
+
"resolved": "https://registry.npmjs.org/winston/-/winston-3.5.0.tgz",
|
|
21439
|
+
"integrity": "sha512-OQMbmLsIdVHvm2hSurrYZs+iZNIImXneYJ6pX7LseSMEq20HdTETXiNnNX3FDwN4LB/xDRZLF6JYOY+AI112Kw==",
|
|
21475
21440
|
"dependencies": {
|
|
21476
21441
|
"@dabh/diagnostics": "^2.0.2",
|
|
21477
21442
|
"async": "^3.2.3",
|
|
@@ -21479,6 +21444,7 @@
|
|
|
21479
21444
|
"logform": "^2.3.2",
|
|
21480
21445
|
"one-time": "^1.0.0",
|
|
21481
21446
|
"readable-stream": "^3.4.0",
|
|
21447
|
+
"safe-stable-stringify": "^2.3.1",
|
|
21482
21448
|
"stack-trace": "0.0.x",
|
|
21483
21449
|
"triple-beam": "^1.3.0",
|
|
21484
21450
|
"winston-transport": "^4.4.2"
|
|
@@ -21500,6 +21466,14 @@
|
|
|
21500
21466
|
"node": ">= 6.4.0"
|
|
21501
21467
|
}
|
|
21502
21468
|
},
|
|
21469
|
+
"node_modules/winston/node_modules/safe-stable-stringify": {
|
|
21470
|
+
"version": "2.3.1",
|
|
21471
|
+
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz",
|
|
21472
|
+
"integrity": "sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg==",
|
|
21473
|
+
"engines": {
|
|
21474
|
+
"node": ">=10"
|
|
21475
|
+
}
|
|
21476
|
+
},
|
|
21503
21477
|
"node_modules/word-wrap": {
|
|
21504
21478
|
"version": "1.2.3",
|
|
21505
21479
|
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
|
|
@@ -24540,14 +24514,6 @@
|
|
|
24540
24514
|
"dompurify": "^2.2.6",
|
|
24541
24515
|
"jsdom": "15.2.1",
|
|
24542
24516
|
"marked": "4.0.10"
|
|
24543
|
-
},
|
|
24544
|
-
"dependencies": {
|
|
24545
|
-
"marked": {
|
|
24546
|
-
"version": "4.0.10",
|
|
24547
|
-
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.10.tgz",
|
|
24548
|
-
"integrity": "sha512-+QvuFj0nGgO970fySghXGmuw+Fd0gD2x3+MqCWLIPf5oxdv1Ka6b2q+z9RP01P/IaKPMEramy+7cNy/Lw8c3hw==",
|
|
24549
|
-
"dev": true
|
|
24550
|
-
}
|
|
24551
24517
|
}
|
|
24552
24518
|
},
|
|
24553
24519
|
"@verdaccio/streams": {
|
|
@@ -24557,9 +24523,9 @@
|
|
|
24557
24523
|
"dev": true
|
|
24558
24524
|
},
|
|
24559
24525
|
"@verdaccio/ui-theme": {
|
|
24560
|
-
"version": "6.0.0-6-next.
|
|
24561
|
-
"resolved": "https://registry.npmjs.org/@verdaccio/ui-theme/-/ui-theme-6.0.0-6-next.
|
|
24562
|
-
"integrity": "sha512-
|
|
24526
|
+
"version": "6.0.0-6-next.16",
|
|
24527
|
+
"resolved": "https://registry.npmjs.org/@verdaccio/ui-theme/-/ui-theme-6.0.0-6-next.16.tgz",
|
|
24528
|
+
"integrity": "sha512-FbYl3273qaA0/fRwrvE876/HuvU81zjsnR70rCEojBelDuddl3xbY1LVdvthCjUGuIj2SUNpTzGhyROdqHJUCg==",
|
|
24563
24529
|
"dev": true
|
|
24564
24530
|
},
|
|
24565
24531
|
"abab": {
|
|
@@ -24813,6 +24779,11 @@
|
|
|
24813
24779
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
|
|
24814
24780
|
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="
|
|
24815
24781
|
},
|
|
24782
|
+
"ansi2html": {
|
|
24783
|
+
"version": "0.0.1",
|
|
24784
|
+
"resolved": "https://registry.npmjs.org/ansi2html/-/ansi2html-0.0.1.tgz",
|
|
24785
|
+
"integrity": "sha1-u4gARhtECvALkb89c2al4LhHO6g="
|
|
24786
|
+
},
|
|
24816
24787
|
"any-observable": {
|
|
24817
24788
|
"version": "0.3.0",
|
|
24818
24789
|
"resolved": "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz",
|
|
@@ -29735,12 +29706,6 @@
|
|
|
29735
29706
|
"node-source-walk": "^4.0.0"
|
|
29736
29707
|
}
|
|
29737
29708
|
},
|
|
29738
|
-
"get-caller-file": {
|
|
29739
|
-
"version": "1.0.3",
|
|
29740
|
-
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
|
|
29741
|
-
"integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==",
|
|
29742
|
-
"dev": true
|
|
29743
|
-
},
|
|
29744
29709
|
"get-intrinsic": {
|
|
29745
29710
|
"version": "1.1.1",
|
|
29746
29711
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
|
|
@@ -32239,9 +32204,9 @@
|
|
|
32239
32204
|
}
|
|
32240
32205
|
},
|
|
32241
32206
|
"marked": {
|
|
32242
|
-
"version": "
|
|
32243
|
-
"resolved": "https://registry.npmjs.org/marked/-/marked-
|
|
32244
|
-
"integrity": "sha512
|
|
32207
|
+
"version": "4.0.10",
|
|
32208
|
+
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.10.tgz",
|
|
32209
|
+
"integrity": "sha512-+QvuFj0nGgO970fySghXGmuw+Fd0gD2x3+MqCWLIPf5oxdv1Ka6b2q+z9RP01P/IaKPMEramy+7cNy/Lw8c3hw==",
|
|
32245
32210
|
"dev": true
|
|
32246
32211
|
},
|
|
32247
32212
|
"matcher": {
|
|
@@ -32621,27 +32586,6 @@
|
|
|
32621
32586
|
"integrity": "sha512-YkjQkdLulFrz0vD4BfNQdQRVmgycXTV7ykuHMlyv+C8WCHazpkiQRDthwa02kSyo8wKnY9wRptHfQLgmf0eR+A==",
|
|
32622
32587
|
"dev": true
|
|
32623
32588
|
},
|
|
32624
|
-
"mock-require": {
|
|
32625
|
-
"version": "3.0.3",
|
|
32626
|
-
"resolved": "https://registry.npmjs.org/mock-require/-/mock-require-3.0.3.tgz",
|
|
32627
|
-
"integrity": "sha512-lLzfLHcyc10MKQnNUCv7dMcoY/2Qxd6wJfbqCcVk3LDb8An4hF6ohk5AztrvgKhJCqj36uyzi/p5se+tvyD+Wg==",
|
|
32628
|
-
"dev": true,
|
|
32629
|
-
"requires": {
|
|
32630
|
-
"get-caller-file": "^1.0.2",
|
|
32631
|
-
"normalize-path": "^2.1.1"
|
|
32632
|
-
},
|
|
32633
|
-
"dependencies": {
|
|
32634
|
-
"normalize-path": {
|
|
32635
|
-
"version": "2.1.1",
|
|
32636
|
-
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
|
|
32637
|
-
"integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
|
|
32638
|
-
"dev": true,
|
|
32639
|
-
"requires": {
|
|
32640
|
-
"remove-trailing-separator": "^1.0.1"
|
|
32641
|
-
}
|
|
32642
|
-
}
|
|
32643
|
-
}
|
|
32644
|
-
},
|
|
32645
32589
|
"module-definition": {
|
|
32646
32590
|
"version": "3.3.1",
|
|
32647
32591
|
"resolved": "https://registry.npmjs.org/module-definition/-/module-definition-3.3.1.tgz",
|
|
@@ -37453,16 +37397,16 @@
|
|
|
37453
37397
|
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
|
|
37454
37398
|
},
|
|
37455
37399
|
"verdaccio": {
|
|
37456
|
-
"version": "5.5.
|
|
37457
|
-
"resolved": "https://registry.npmjs.org/verdaccio/-/verdaccio-5.5.
|
|
37458
|
-
"integrity": "sha512-
|
|
37400
|
+
"version": "5.5.2",
|
|
37401
|
+
"resolved": "https://registry.npmjs.org/verdaccio/-/verdaccio-5.5.2.tgz",
|
|
37402
|
+
"integrity": "sha512-SU107gfxE8FLrwp5GezhmWE0otWTAb7xIcz/m931vqOPjeH2MwbMf0+WuCDQ5O80XxdwurlK/JFNRYzDzqUrMA==",
|
|
37459
37403
|
"dev": true,
|
|
37460
37404
|
"requires": {
|
|
37461
37405
|
"@verdaccio/commons-api": "10.1.0",
|
|
37462
37406
|
"@verdaccio/local-storage": "10.1.1",
|
|
37463
37407
|
"@verdaccio/readme": "10.2.1",
|
|
37464
37408
|
"@verdaccio/streams": "10.1.0",
|
|
37465
|
-
"@verdaccio/ui-theme": "6.0.0-6-next.
|
|
37409
|
+
"@verdaccio/ui-theme": "6.0.0-6-next.16",
|
|
37466
37410
|
"async": "3.2.3",
|
|
37467
37411
|
"body-parser": "1.19.1",
|
|
37468
37412
|
"clipanion": "3.1.0",
|
|
@@ -37485,9 +37429,9 @@
|
|
|
37485
37429
|
"lodash": "4.17.21",
|
|
37486
37430
|
"lru-cache": "6.0.0",
|
|
37487
37431
|
"lunr-mutable-indexes": "2.3.2",
|
|
37488
|
-
"marked": "
|
|
37432
|
+
"marked": "4.0.10",
|
|
37489
37433
|
"memoizee": "0.4.15",
|
|
37490
|
-
"mime": "
|
|
37434
|
+
"mime": "3.0.0",
|
|
37491
37435
|
"minimatch": "3.0.4",
|
|
37492
37436
|
"mkdirp": "1.0.4",
|
|
37493
37437
|
"mv": "2.1.1",
|
|
@@ -37522,9 +37466,9 @@
|
|
|
37522
37466
|
}
|
|
37523
37467
|
},
|
|
37524
37468
|
"mime": {
|
|
37525
|
-
"version": "
|
|
37526
|
-
"resolved": "https://registry.npmjs.org/mime/-/mime-
|
|
37527
|
-
"integrity": "sha512-
|
|
37469
|
+
"version": "3.0.0",
|
|
37470
|
+
"resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
|
|
37471
|
+
"integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
|
|
37528
37472
|
"dev": true
|
|
37529
37473
|
},
|
|
37530
37474
|
"mkdirp": {
|
|
@@ -37771,9 +37715,9 @@
|
|
|
37771
37715
|
}
|
|
37772
37716
|
},
|
|
37773
37717
|
"winston": {
|
|
37774
|
-
"version": "3.
|
|
37775
|
-
"resolved": "https://registry.npmjs.org/winston/-/winston-3.
|
|
37776
|
-
"integrity": "sha512-
|
|
37718
|
+
"version": "3.5.0",
|
|
37719
|
+
"resolved": "https://registry.npmjs.org/winston/-/winston-3.5.0.tgz",
|
|
37720
|
+
"integrity": "sha512-OQMbmLsIdVHvm2hSurrYZs+iZNIImXneYJ6pX7LseSMEq20HdTETXiNnNX3FDwN4LB/xDRZLF6JYOY+AI112Kw==",
|
|
37777
37721
|
"requires": {
|
|
37778
37722
|
"@dabh/diagnostics": "^2.0.2",
|
|
37779
37723
|
"async": "^3.2.3",
|
|
@@ -37781,9 +37725,17 @@
|
|
|
37781
37725
|
"logform": "^2.3.2",
|
|
37782
37726
|
"one-time": "^1.0.0",
|
|
37783
37727
|
"readable-stream": "^3.4.0",
|
|
37728
|
+
"safe-stable-stringify": "^2.3.1",
|
|
37784
37729
|
"stack-trace": "0.0.x",
|
|
37785
37730
|
"triple-beam": "^1.3.0",
|
|
37786
37731
|
"winston-transport": "^4.4.2"
|
|
37732
|
+
},
|
|
37733
|
+
"dependencies": {
|
|
37734
|
+
"safe-stable-stringify": {
|
|
37735
|
+
"version": "2.3.1",
|
|
37736
|
+
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz",
|
|
37737
|
+
"integrity": "sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg=="
|
|
37738
|
+
}
|
|
37787
37739
|
}
|
|
37788
37740
|
},
|
|
37789
37741
|
"winston-transport": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.16.0-rc-eh",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"test:dev:ava": "ava --verbose",
|
|
65
65
|
"test:ci:ava": "c8 -r json ava",
|
|
66
66
|
"test:affected": "node ./tools/affected-test.js",
|
|
67
|
-
"e2e": "node ./tools/e2e/run.
|
|
67
|
+
"e2e": "node ./tools/e2e/run.mjs",
|
|
68
68
|
"docs": "node ./site/scripts/docs.js",
|
|
69
69
|
"watch": "c8 --reporter=lcov ava --watch",
|
|
70
70
|
"site:build": "run-s site:build:*",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"postinstall": "node ./scripts/postinstall.js"
|
|
74
74
|
},
|
|
75
75
|
"config": {
|
|
76
|
-
"eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,tools,scripts,site,tests,.github}/**/*.{js,md,html}\" \"*.{js,md,html}\" \".*.{js,md,html}\"",
|
|
77
|
-
"prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{js,md,yml,json,html}\" \"*.{js,yml,json,html}\" \".*.{js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!.github/**/*.md\""
|
|
76
|
+
"eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,html}\" \"*.{mjs,cjs,js,md,html}\" \".*.{mjs,cjs,js,md,html}\"",
|
|
77
|
+
"prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!.github/**/*.md\""
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@netlify/build": "^26.2.0",
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"@sindresorhus/slugify": "^1.1.0",
|
|
90
90
|
"ansi-escapes": "^5.0.0",
|
|
91
91
|
"ansi-styles": "^5.0.0",
|
|
92
|
+
"ansi2html": "^0.0.1",
|
|
92
93
|
"ascii-table": "0.0.9",
|
|
93
94
|
"backoff": "^2.5.0",
|
|
94
95
|
"better-opn": "^3.0.0",
|
|
@@ -103,6 +104,7 @@
|
|
|
103
104
|
"content-type": "^1.0.4",
|
|
104
105
|
"cookie": "^0.4.0",
|
|
105
106
|
"copy-template-dir": "^1.4.0",
|
|
107
|
+
"cron-parser": "^4.2.1",
|
|
106
108
|
"debug": "^4.1.1",
|
|
107
109
|
"decache": "^4.6.0",
|
|
108
110
|
"del": "^6.0.0",
|
|
@@ -197,7 +199,6 @@
|
|
|
197
199
|
"ini": "^2.0.0",
|
|
198
200
|
"jsonwebtoken": "^8.5.1",
|
|
199
201
|
"mock-fs": "^5.1.2",
|
|
200
|
-
"mock-require": "^3.0.3",
|
|
201
202
|
"p-timeout": "^4.0.0",
|
|
202
203
|
"proxyquire": "^2.1.3",
|
|
203
204
|
"seedrandom": "^3.0.5",
|
|
@@ -20,7 +20,6 @@ const {
|
|
|
20
20
|
NETLIFYDEVERR,
|
|
21
21
|
NETLIFYDEVLOG,
|
|
22
22
|
chalk,
|
|
23
|
-
deployEdgeHandlers,
|
|
24
23
|
deploySite,
|
|
25
24
|
error,
|
|
26
25
|
exit,
|
|
@@ -313,12 +312,6 @@ const runDeploy = async ({
|
|
|
313
312
|
results = await api.createSiteDeploy({ siteId, title, body: { draft, branch: alias } })
|
|
314
313
|
deployId = results.id
|
|
315
314
|
|
|
316
|
-
await deployEdgeHandlers({
|
|
317
|
-
site,
|
|
318
|
-
deployId,
|
|
319
|
-
api,
|
|
320
|
-
silent,
|
|
321
|
-
})
|
|
322
315
|
const internalFunctionsFolder = await getInternalFunctionsDir({ base: site.root })
|
|
323
316
|
|
|
324
317
|
// The order of the directories matter: zip-it-and-ship-it will prioritize
|
|
@@ -3,10 +3,11 @@ const fs = require('fs')
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const process = require('process')
|
|
5
5
|
|
|
6
|
+
const CronParser = require('cron-parser')
|
|
6
7
|
const inquirer = require('inquirer')
|
|
7
8
|
const fetch = require('node-fetch')
|
|
8
9
|
|
|
9
|
-
const { BACKGROUND, NETLIFYDEVWARN, chalk, error, exit, getFunctions } = require('../../utils')
|
|
10
|
+
const { BACKGROUND, CLOCKWORK_USERAGENT, NETLIFYDEVWARN, chalk, error, exit, getFunctions } = require('../../utils')
|
|
10
11
|
|
|
11
12
|
// https://www.netlify.com/docs/functions/#event-triggered-functions
|
|
12
13
|
const events = [
|
|
@@ -130,6 +131,13 @@ const getFunctionToTrigger = function (options, argumentName) {
|
|
|
130
131
|
return argumentName
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
const getNextRun = function (schedule) {
|
|
135
|
+
const cron = CronParser.parseExpression(schedule, {
|
|
136
|
+
tz: 'Etc/UTC',
|
|
137
|
+
})
|
|
138
|
+
return cron.next().toDate()
|
|
139
|
+
}
|
|
140
|
+
|
|
133
141
|
/**
|
|
134
142
|
* The functions:invoke command
|
|
135
143
|
* @param {string} nameArgument
|
|
@@ -150,11 +158,18 @@ const functionsInvoke = async (nameArgument, options, command) => {
|
|
|
150
158
|
|
|
151
159
|
const functions = await getFunctions(functionsDir)
|
|
152
160
|
const functionToTrigger = await getNameFromArgs(functions, options, nameArgument)
|
|
161
|
+
const functionObj = functions.find((func) => func.name === functionToTrigger)
|
|
153
162
|
|
|
154
163
|
let headers = {}
|
|
155
164
|
let body = {}
|
|
156
165
|
|
|
157
|
-
if (
|
|
166
|
+
if (functionObj.schedule) {
|
|
167
|
+
body.next_run = getNextRun(functionObj.schedule)
|
|
168
|
+
headers = {
|
|
169
|
+
'user-agent': CLOCKWORK_USERAGENT,
|
|
170
|
+
'X-NF-Event': 'schedule',
|
|
171
|
+
}
|
|
172
|
+
} else if (eventTriggeredFunctions.has(functionToTrigger)) {
|
|
158
173
|
/** handle event triggered fns */
|
|
159
174
|
// https://www.netlify.com/docs/functions/#event-triggered-functions
|
|
160
175
|
const [name, event] = functionToTrigger.split('-')
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"stripe": "^8.
|
|
12
|
+
"stripe": "^8.201.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@types/node": {
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
"node_modules/stripe": {
|
|
108
|
-
"version": "8.
|
|
109
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.
|
|
110
|
-
"integrity": "sha512-
|
|
108
|
+
"version": "8.201.0",
|
|
109
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.201.0.tgz",
|
|
110
|
+
"integrity": "sha512-pF0F1DdE9zt0U6Cb0XN+REpdFkUmaqp6C7OEVOCeUpTAafjjJqrdV/WmZd7Y5MwT8XvDAxB5/v3CAXwxAp0XNg==",
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@types/node": ">=8.1.0",
|
|
113
113
|
"qs": "^6.6.0"
|
|
@@ -184,9 +184,9 @@
|
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
"stripe": {
|
|
187
|
-
"version": "8.
|
|
188
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.
|
|
189
|
-
"integrity": "sha512-
|
|
187
|
+
"version": "8.201.0",
|
|
188
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.201.0.tgz",
|
|
189
|
+
"integrity": "sha512-pF0F1DdE9zt0U6Cb0XN+REpdFkUmaqp6C7OEVOCeUpTAafjjJqrdV/WmZd7Y5MwT8XvDAxB5/v3CAXwxAp0XNg==",
|
|
190
190
|
"requires": {
|
|
191
191
|
"@types/node": ">=8.1.0",
|
|
192
192
|
"qs": "^6.6.0"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"stripe": "^8.
|
|
12
|
+
"stripe": "^8.201.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@types/node": {
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
"node_modules/stripe": {
|
|
108
|
-
"version": "8.
|
|
109
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.
|
|
110
|
-
"integrity": "sha512-
|
|
108
|
+
"version": "8.201.0",
|
|
109
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.201.0.tgz",
|
|
110
|
+
"integrity": "sha512-pF0F1DdE9zt0U6Cb0XN+REpdFkUmaqp6C7OEVOCeUpTAafjjJqrdV/WmZd7Y5MwT8XvDAxB5/v3CAXwxAp0XNg==",
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@types/node": ">=8.1.0",
|
|
113
113
|
"qs": "^6.6.0"
|
|
@@ -184,9 +184,9 @@
|
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
"stripe": {
|
|
187
|
-
"version": "8.
|
|
188
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.
|
|
189
|
-
"integrity": "sha512-
|
|
187
|
+
"version": "8.201.0",
|
|
188
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.201.0.tgz",
|
|
189
|
+
"integrity": "sha512-pF0F1DdE9zt0U6Cb0XN+REpdFkUmaqp6C7OEVOCeUpTAafjjJqrdV/WmZd7Y5MwT8XvDAxB5/v3CAXwxAp0XNg==",
|
|
190
190
|
"requires": {
|
|
191
191
|
"@types/node": ">=8.1.0",
|
|
192
192
|
"qs": "^6.6.0"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
const { getPathInProject } = require('../settings')
|
|
5
|
+
|
|
6
|
+
const EDGE_HANDLERS_FOLDER = 'edge-handlers-dist'
|
|
7
|
+
const PUBLIC_URL_PATH = '.netlify/internal/edge-handlers'
|
|
8
|
+
|
|
9
|
+
const internalPath = getPathInProject([EDGE_HANDLERS_FOLDER])
|
|
10
|
+
|
|
11
|
+
const deployFileNormalizer = (file) => {
|
|
12
|
+
const isEdgeHandler = file.root === internalPath
|
|
13
|
+
const normalizedPath = isEdgeHandler ? path.join(PUBLIC_URL_PATH, file.normalizedPath) : file.normalizedPath
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
...file,
|
|
17
|
+
normalizedPath,
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const isEdgeHandlerFile = (filePath) => filePath.startsWith(`${PUBLIC_URL_PATH}${path.sep}`)
|
|
22
|
+
|
|
23
|
+
module.exports = { deployFileNormalizer, internalPath, isEdgeHandlerFile }
|
|
@@ -32,6 +32,7 @@ class NetlifyFunction {
|
|
|
32
32
|
// Determines whether this is a background function based on the function
|
|
33
33
|
// name.
|
|
34
34
|
this.isBackground = name.endsWith(BACKGROUND_SUFFIX)
|
|
35
|
+
this.schedule = null
|
|
35
36
|
|
|
36
37
|
// List of the function's source files. This starts out as an empty set
|
|
37
38
|
// and will get populated on every build.
|
|
@@ -44,6 +45,12 @@ class NetlifyFunction {
|
|
|
44
45
|
return /^[A-Za-z0-9_-]+$/.test(this.name)
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
async isScheduled() {
|
|
49
|
+
await this.buildQueue
|
|
50
|
+
|
|
51
|
+
return Boolean(this.schedule)
|
|
52
|
+
}
|
|
53
|
+
|
|
47
54
|
// The `build` method transforms source files into invocable functions. Its
|
|
48
55
|
// return value is an object with:
|
|
49
56
|
//
|
|
@@ -61,12 +68,13 @@ class NetlifyFunction {
|
|
|
61
68
|
this.buildQueue = buildFunction({ cache })
|
|
62
69
|
|
|
63
70
|
try {
|
|
64
|
-
const { srcFiles, ...buildData } = await this.buildQueue
|
|
71
|
+
const { schedule, srcFiles, ...buildData } = await this.buildQueue
|
|
65
72
|
const srcFilesSet = new Set(srcFiles)
|
|
66
73
|
const srcFilesDiff = this.getSrcFilesDiff(srcFilesSet)
|
|
67
74
|
|
|
68
75
|
this.buildData = buildData
|
|
69
76
|
this.srcFiles = srcFilesSet
|
|
77
|
+
this.schedule = schedule
|
|
70
78
|
|
|
71
79
|
return { srcFilesDiff }
|
|
72
80
|
} catch (error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { mkdir, writeFile } = require('fs').promises
|
|
2
2
|
const path = require('path')
|
|
3
3
|
|
|
4
|
-
const { zipFunction } = require('@netlify/zip-it-and-ship-it')
|
|
4
|
+
const { listFunction, zipFunction } = require('@netlify/zip-it-and-ship-it')
|
|
5
5
|
const decache = require('decache')
|
|
6
6
|
const readPkgUp = require('read-pkg-up')
|
|
7
7
|
const sourceMapSupport = require('source-map-support')
|
|
@@ -35,7 +35,11 @@ const buildFunction = async ({ cache, config, directory, func, hasTypeModule, pr
|
|
|
35
35
|
// root of the functions directory (e.g. `functions/my-func.js`). In
|
|
36
36
|
// this case, we use `mainFile` as the function path of `zipFunction`.
|
|
37
37
|
const entryPath = functionDirectory === directory ? func.mainFile : functionDirectory
|
|
38
|
-
const {
|
|
38
|
+
const {
|
|
39
|
+
inputs,
|
|
40
|
+
path: functionPath,
|
|
41
|
+
schedule,
|
|
42
|
+
} = await memoizedBuild({
|
|
39
43
|
cache,
|
|
40
44
|
cacheKey: `zisi-${entryPath}`,
|
|
41
45
|
command: () => zipFunction(entryPath, targetDirectory, zipOptions),
|
|
@@ -56,7 +60,22 @@ const buildFunction = async ({ cache, config, directory, func, hasTypeModule, pr
|
|
|
56
60
|
|
|
57
61
|
clearFunctionsCache(targetDirectory)
|
|
58
62
|
|
|
59
|
-
return { buildPath, srcFiles }
|
|
63
|
+
return { buildPath, srcFiles, schedule }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {object} params
|
|
68
|
+
* @param {unknown} params.config
|
|
69
|
+
* @param {string} params.mainFile
|
|
70
|
+
* @param {string} params.projectRoot
|
|
71
|
+
*/
|
|
72
|
+
const parseForSchedule = async ({ config, mainFile, projectRoot }) => {
|
|
73
|
+
const listedFunction = await listFunction(mainFile, {
|
|
74
|
+
config: netlifyConfigToZisiConfig({ config, projectRoot }),
|
|
75
|
+
parseISC: true,
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
return listedFunction && listedFunction.schedule
|
|
60
79
|
}
|
|
61
80
|
|
|
62
81
|
// Clears the cache for any files inside the directory from which functions are
|
|
@@ -79,10 +98,11 @@ const getTargetDirectory = async ({ errorExit }) => {
|
|
|
79
98
|
return targetDirectory
|
|
80
99
|
}
|
|
81
100
|
|
|
101
|
+
const netlifyConfigToZisiConfig = ({ config, projectRoot }) =>
|
|
102
|
+
addFunctionsConfigDefaults(normalizeFunctionsConfig({ functionsConfig: config.functions, projectRoot }))
|
|
103
|
+
|
|
82
104
|
module.exports = async ({ config, directory, errorExit, func, projectRoot }) => {
|
|
83
|
-
const functionsConfig =
|
|
84
|
-
normalizeFunctionsConfig({ functionsConfig: config.functions, projectRoot }),
|
|
85
|
-
)
|
|
105
|
+
const functionsConfig = netlifyConfigToZisiConfig({ config, projectRoot })
|
|
86
106
|
|
|
87
107
|
const packageJson = await readPkgUp(func.mainFile)
|
|
88
108
|
const hasTypeModule = packageJson && packageJson.packageJson.type === 'module'
|
|
@@ -115,3 +135,5 @@ module.exports = async ({ config, directory, errorExit, func, projectRoot }) =>
|
|
|
115
135
|
target: targetDirectory,
|
|
116
136
|
}
|
|
117
137
|
}
|
|
138
|
+
|
|
139
|
+
module.exports.parseForSchedule = parseForSchedule
|
|
@@ -46,8 +46,9 @@ const getBuildFunction = async ({ config, directory, errorExit, func, projectRoo
|
|
|
46
46
|
// main file otherwise.
|
|
47
47
|
const functionDirectory = dirname(func.mainFile)
|
|
48
48
|
const srcFiles = functionDirectory === directory ? [func.mainFile] : [functionDirectory]
|
|
49
|
+
const schedule = await detectZisiBuilder.parseForSchedule({ mainFile: func.mainFile, config, projectRoot })
|
|
49
50
|
|
|
50
|
-
return () => ({ srcFiles })
|
|
51
|
+
return () => ({ schedule, srcFiles })
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
const invokeFunction = async ({ context, event, func, timeout }) => {
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const ansi2html = require('ansi2html')
|
|
2
|
+
|
|
3
|
+
const { CLOCKWORK_USERAGENT } = require('../../utils')
|
|
4
|
+
|
|
5
|
+
const { formatLambdaError } = require('./utils')
|
|
6
|
+
|
|
7
|
+
const buildHelpResponse = ({ error, headers, path, result }) => {
|
|
8
|
+
const acceptsHtml = headers.accept && headers.accept.includes('text/html')
|
|
9
|
+
|
|
10
|
+
const paragraph = (text) => {
|
|
11
|
+
text = text.trim()
|
|
12
|
+
|
|
13
|
+
if (acceptsHtml) {
|
|
14
|
+
return ansi2html(`<p>${text}</p>`)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
text = text
|
|
18
|
+
.replace(/<pre><code>/gm, '```\n')
|
|
19
|
+
.replace(/<\/code><\/pre>/gm, '\n```')
|
|
20
|
+
.replace(/<code>/gm, '`')
|
|
21
|
+
.replace(/<\/code>/gm, '`')
|
|
22
|
+
|
|
23
|
+
return `${text}\n\n`
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const isSimulatedRequest = headers['user-agent'] === CLOCKWORK_USERAGENT
|
|
27
|
+
|
|
28
|
+
let message = ''
|
|
29
|
+
|
|
30
|
+
if (!isSimulatedRequest) {
|
|
31
|
+
message += paragraph(`
|
|
32
|
+
You performed an HTTP request to <code>${path}</code>, which is a scheduled function.
|
|
33
|
+
You can do this to test your functions locally, but it won't work in production.
|
|
34
|
+
`)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (error) {
|
|
38
|
+
message += paragraph(`
|
|
39
|
+
There was an error during execution of your scheduled function:
|
|
40
|
+
|
|
41
|
+
<pre><code>${formatLambdaError(error)}</code></pre>`)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (result) {
|
|
45
|
+
// lambda emulator adds level field, which isn't user-provided
|
|
46
|
+
const returnValue = { ...result }
|
|
47
|
+
delete returnValue.level
|
|
48
|
+
|
|
49
|
+
const { statusCode } = returnValue
|
|
50
|
+
if (statusCode >= 500) {
|
|
51
|
+
message += paragraph(`
|
|
52
|
+
Your function returned a status code of <code>${statusCode}</code>.
|
|
53
|
+
At the moment, Netlify does nothing about that. In the future, there might be a retry mechanism based on this.
|
|
54
|
+
`)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const allowedKeys = new Set(['statusCode'])
|
|
58
|
+
const returnedKeys = Object.keys(returnValue)
|
|
59
|
+
const ignoredKeys = returnedKeys.filter((key) => !allowedKeys.has(key))
|
|
60
|
+
|
|
61
|
+
if (ignoredKeys.length !== 0) {
|
|
62
|
+
message += paragraph(
|
|
63
|
+
`Your function returned ${ignoredKeys
|
|
64
|
+
.map((key) => `<code>${key}</code>`)
|
|
65
|
+
.join(', ')}. Is this an accident? It won't be interpreted by Netlify.`,
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const statusCode = error ? 500 : 200
|
|
71
|
+
return acceptsHtml
|
|
72
|
+
? {
|
|
73
|
+
statusCode,
|
|
74
|
+
contentType: 'text/html',
|
|
75
|
+
message: `<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">\n
|
|
76
|
+
${message}`,
|
|
77
|
+
}
|
|
78
|
+
: {
|
|
79
|
+
statusCode,
|
|
80
|
+
contentType: 'text/plain',
|
|
81
|
+
message,
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const handleScheduledFunction = ({ error, request, response, result }) => {
|
|
86
|
+
const { contentType, message, statusCode } = buildHelpResponse({
|
|
87
|
+
error,
|
|
88
|
+
headers: request.headers,
|
|
89
|
+
path: request.path,
|
|
90
|
+
result,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
response.status(statusCode)
|
|
94
|
+
response.set('Content-Type', contentType)
|
|
95
|
+
response.send(message)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = { handleScheduledFunction, buildHelpResponse }
|
|
@@ -6,6 +6,7 @@ const { NETLIFYDEVERR, NETLIFYDEVLOG, error: errorExit, getInternalFunctionsDir,
|
|
|
6
6
|
const { handleBackgroundFunction, handleBackgroundFunctionResult } = require('./background')
|
|
7
7
|
const { createFormSubmissionHandler } = require('./form-submissions-handler')
|
|
8
8
|
const { FunctionsRegistry } = require('./registry')
|
|
9
|
+
const { handleScheduledFunction } = require('./scheduled')
|
|
9
10
|
const { handleSynchronousFunction } = require('./synchronous')
|
|
10
11
|
const { shouldBase64Encode } = require('./utils')
|
|
11
12
|
|
|
@@ -105,6 +106,15 @@ const createHandler = function ({ functionsRegistry }) {
|
|
|
105
106
|
const { error } = await func.invoke(event, clientContext)
|
|
106
107
|
|
|
107
108
|
handleBackgroundFunctionResult(functionName, error)
|
|
109
|
+
} else if (await func.isScheduled()) {
|
|
110
|
+
const { error, result } = await func.invoke(event, clientContext)
|
|
111
|
+
|
|
112
|
+
handleScheduledFunction({
|
|
113
|
+
error,
|
|
114
|
+
result,
|
|
115
|
+
request,
|
|
116
|
+
response,
|
|
117
|
+
})
|
|
108
118
|
} else {
|
|
109
119
|
const { error, result } = await func.invoke(event, clientContext)
|
|
110
120
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const cleanDeep = require('clean-deep')
|
|
2
2
|
const tempy = require('tempy')
|
|
3
3
|
|
|
4
|
+
const edgeHandlers = require('../../lib/edge-handlers')
|
|
4
5
|
const { rmdirRecursiveAsync } = require('../../lib/fs')
|
|
5
6
|
const { warn } = require('../command-helpers')
|
|
6
7
|
|
|
@@ -52,9 +53,18 @@ const deploySite = async (
|
|
|
52
53
|
phase: 'start',
|
|
53
54
|
})
|
|
54
55
|
|
|
56
|
+
const edgeHandlersPath = edgeHandlers.internalPath
|
|
55
57
|
const [{ files, filesShaMap }, { fnShaMap, functionSchedules, functions, functionsWithNativeModules }] =
|
|
56
58
|
await Promise.all([
|
|
57
|
-
hashFiles(
|
|
59
|
+
hashFiles({
|
|
60
|
+
assetType,
|
|
61
|
+
concurrentHash,
|
|
62
|
+
directories: [configPath, dir, edgeHandlersPath],
|
|
63
|
+
filter,
|
|
64
|
+
hashAlgorithm,
|
|
65
|
+
normalizer: edgeHandlers.deployFileNormalizer,
|
|
66
|
+
statusCb,
|
|
67
|
+
}),
|
|
58
68
|
hashFns(fnDir, {
|
|
59
69
|
functionsConfig,
|
|
60
70
|
tmpDir,
|
|
@@ -67,13 +77,18 @@ const deploySite = async (
|
|
|
67
77
|
skipFunctionsCache,
|
|
68
78
|
}),
|
|
69
79
|
])
|
|
70
|
-
const
|
|
80
|
+
const edgeHandlersCount = Object.keys(files).filter(edgeHandlers.isEdgeHandlerFile).length
|
|
81
|
+
const filesCount = Object.keys(files).length - edgeHandlersCount
|
|
71
82
|
const functionsCount = Object.keys(functions).length
|
|
72
|
-
const
|
|
83
|
+
const stats = buildStatsString([
|
|
84
|
+
filesCount > 0 && `${filesCount} files`,
|
|
85
|
+
functionsCount > 0 && `${functionsCount} functions`,
|
|
86
|
+
edgeHandlersCount > 0 && `${edgeHandlersCount} Edge Handlers`,
|
|
87
|
+
])
|
|
73
88
|
|
|
74
89
|
statusCb({
|
|
75
90
|
type: 'hashing',
|
|
76
|
-
msg: `Finished hashing ${
|
|
91
|
+
msg: `Finished hashing ${stats}`,
|
|
77
92
|
phase: 'stop',
|
|
78
93
|
})
|
|
79
94
|
|
|
@@ -163,4 +178,11 @@ For more information, visit https://ntl.fyi/cli-native-modules.`)
|
|
|
163
178
|
return deployManifest
|
|
164
179
|
}
|
|
165
180
|
|
|
181
|
+
const buildStatsString = (possibleParts) => {
|
|
182
|
+
const parts = possibleParts.filter(Boolean)
|
|
183
|
+
const message = parts.slice(0, -1).join(', ')
|
|
184
|
+
|
|
185
|
+
return parts.length > 1 ? `${message} and ${parts[parts.length - 1]}` : message
|
|
186
|
+
}
|
|
187
|
+
|
|
166
188
|
module.exports = { deploySite }
|
|
@@ -5,16 +5,21 @@ const pump = promisify(require('pump'))
|
|
|
5
5
|
|
|
6
6
|
const { fileFilterCtor, fileNormalizerCtor, hasherCtor, manifestCollectorCtor } = require('./hasher-segments')
|
|
7
7
|
|
|
8
|
-
const hashFiles = async (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const hashFiles = async ({
|
|
9
|
+
assetType = 'file',
|
|
10
|
+
concurrentHash,
|
|
11
|
+
directories,
|
|
12
|
+
filter,
|
|
13
|
+
hashAlgorithm = 'sha1',
|
|
14
|
+
normalizer,
|
|
15
|
+
statusCb,
|
|
16
|
+
}) => {
|
|
13
17
|
if (!filter) throw new Error('Missing filter function option')
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
const fileStream = walker(directories, { filter })
|
|
15
20
|
const fileFilter = fileFilterCtor()
|
|
16
21
|
const hasher = hasherCtor({ concurrentHash, hashAlgorithm })
|
|
17
|
-
const fileNormalizer = fileNormalizerCtor({ assetType })
|
|
22
|
+
const fileNormalizer = fileNormalizerCtor({ assetType, normalizer })
|
|
18
23
|
|
|
19
24
|
// Written to by manifestCollector
|
|
20
25
|
// normalizedPath: hash (wanted by deploy API)
|
|
@@ -24,8 +24,16 @@ const hasherCtor = ({ concurrentHash, hashAlgorithm }) => {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// Inject normalized file names into normalizedPath and assetType
|
|
27
|
-
const fileNormalizerCtor = ({ assetType }) =>
|
|
28
|
-
map((fileObj) =>
|
|
27
|
+
const fileNormalizerCtor = ({ assetType, normalizer: normalizeFunction }) =>
|
|
28
|
+
map((fileObj) => {
|
|
29
|
+
const normalizedFile = { ...fileObj, assetType, normalizedPath: normalizePath(fileObj.relname) }
|
|
30
|
+
|
|
31
|
+
if (normalizeFunction !== undefined) {
|
|
32
|
+
return normalizeFunction(normalizedFile)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return normalizedFile
|
|
36
|
+
})
|
|
29
37
|
|
|
30
38
|
// A writable stream segment ctor that normalizes file paths, and writes shaMap's
|
|
31
39
|
const manifestCollectorCtor = (filesObj, shaMap, { assetType, statusCb }) => {
|
|
@@ -5,10 +5,10 @@ const getUrlPath = (functionName) => `/.netlify/functions/${functionName}`
|
|
|
5
5
|
|
|
6
6
|
const BACKGROUND = '-background'
|
|
7
7
|
|
|
8
|
-
const addFunctionProps = ({ mainFile, name, runtime }) => {
|
|
8
|
+
const addFunctionProps = ({ mainFile, name, runtime, schedule }) => {
|
|
9
9
|
const urlPath = getUrlPath(name)
|
|
10
10
|
const isBackground = name.endsWith(BACKGROUND)
|
|
11
|
-
return { mainFile, name, runtime, urlPath, isBackground }
|
|
11
|
+
return { mainFile, name, runtime, urlPath, isBackground, schedule }
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const JS = 'js'
|
|
@@ -21,7 +21,9 @@ const getFunctions = async (functionsSrcDir) => {
|
|
|
21
21
|
// performance optimization, load '@netlify/zip-it-and-ship-it' on demand
|
|
22
22
|
// eslint-disable-next-line node/global-require
|
|
23
23
|
const { listFunctions } = require('@netlify/zip-it-and-ship-it')
|
|
24
|
-
const functions = await listFunctions(functionsSrcDir
|
|
24
|
+
const functions = await listFunctions(functionsSrcDir, {
|
|
25
|
+
parseISC: true,
|
|
26
|
+
})
|
|
25
27
|
const functionsWithProps = functions.filter(({ runtime }) => runtime === JS).map((func) => addFunctionProps(func))
|
|
26
28
|
return functionsWithProps
|
|
27
29
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
const edgeHandlers = require('
|
|
1
|
+
const edgeHandlers = require('../../lib/edge-handlers')
|
|
2
|
+
|
|
3
|
+
const constants = require('./constants')
|
|
2
4
|
const functions = require('./functions')
|
|
3
5
|
const getFunctions = require('./get-functions')
|
|
4
6
|
|
|
5
7
|
module.exports = {
|
|
8
|
+
...constants,
|
|
6
9
|
...functions,
|
|
7
10
|
...edgeHandlers,
|
|
8
11
|
...getFunctions,
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
const fs = require('fs').promises
|
|
3
|
-
const path = require('path')
|
|
4
|
-
|
|
5
|
-
const { cancelDeploy, uploadEdgeHandlers } = require('../../lib/api')
|
|
6
|
-
const { readFileAsyncCatchError } = require('../../lib/fs')
|
|
7
|
-
const { startSpinner, stopSpinner } = require('../../lib/spinner')
|
|
8
|
-
const { error } = require('../command-helpers')
|
|
9
|
-
|
|
10
|
-
const MANIFEST_FILENAME = 'manifest.json'
|
|
11
|
-
const EDGE_HANDLERS_FOLDER = '.netlify/edge-handlers'
|
|
12
|
-
|
|
13
|
-
const validateEdgeHandlerFolder = async ({ site }) => {
|
|
14
|
-
try {
|
|
15
|
-
const resolvedFolder = path.resolve(site.root, EDGE_HANDLERS_FOLDER)
|
|
16
|
-
const stat = await fs.stat(resolvedFolder)
|
|
17
|
-
if (!stat.isDirectory()) {
|
|
18
|
-
error(`Edge Handlers folder ${EDGE_HANDLERS_FOLDER} must be a path to a directory`)
|
|
19
|
-
}
|
|
20
|
-
return resolvedFolder
|
|
21
|
-
} catch {
|
|
22
|
-
// ignore errors at the moment
|
|
23
|
-
// TODO: report error if 'edge_handlers' config exists after
|
|
24
|
-
// https://github.com/netlify/build/pull/1829 is published
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const readBundleAndManifest = async ({ edgeHandlersResolvedFolder }) => {
|
|
29
|
-
const manifestPath = path.resolve(edgeHandlersResolvedFolder, MANIFEST_FILENAME)
|
|
30
|
-
const { content: manifest, error: manifestError } = await readFileAsyncCatchError(manifestPath)
|
|
31
|
-
if (manifestError) {
|
|
32
|
-
error(`Could not read Edge Handlers manifest file ${manifestPath}: ${manifestError.message}`)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let manifestJson
|
|
36
|
-
try {
|
|
37
|
-
manifestJson = JSON.parse(manifest)
|
|
38
|
-
} catch (error_) {
|
|
39
|
-
error(`Edge Handlers manifest file is not a valid JSON file: ${error_.message}`)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (!manifestJson.sha) {
|
|
43
|
-
error(`Edge Handlers manifest file is missing the 'sha' property`)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const bundlePath = path.resolve(edgeHandlersResolvedFolder, manifestJson.sha)
|
|
47
|
-
const { content: bundleBuffer, error: bundleError } = await readFileAsyncCatchError(bundlePath)
|
|
48
|
-
|
|
49
|
-
if (bundleError) {
|
|
50
|
-
error(`Could not read Edge Handlers bundle file ${bundlePath}: ${bundleError.message}`)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return { bundleBuffer, manifest: manifestJson }
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const deployEdgeHandlers = async ({ api, deployId, silent, site }) => {
|
|
57
|
-
const edgeHandlersResolvedFolder = await validateEdgeHandlerFolder({ site })
|
|
58
|
-
if (edgeHandlersResolvedFolder) {
|
|
59
|
-
let spinner
|
|
60
|
-
try {
|
|
61
|
-
spinner = silent
|
|
62
|
-
? null
|
|
63
|
-
: startSpinner({ text: `Deploying Edge Handlers from directory ${edgeHandlersResolvedFolder}` })
|
|
64
|
-
|
|
65
|
-
const { bundleBuffer, manifest } = await readBundleAndManifest({ edgeHandlersResolvedFolder })
|
|
66
|
-
// returns false if the bundle exists, true on success, throws on error
|
|
67
|
-
const success = await uploadEdgeHandlers({
|
|
68
|
-
api,
|
|
69
|
-
deployId,
|
|
70
|
-
bundleBuffer,
|
|
71
|
-
manifest,
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
const text = success
|
|
75
|
-
? `Finished deploying Edge Handlers from directory: ${edgeHandlersResolvedFolder}`
|
|
76
|
-
: `Skipped deploying Edge Handlers since the bundle already exists`
|
|
77
|
-
stopSpinner({ spinner, text, error: false })
|
|
78
|
-
} catch (error_) {
|
|
79
|
-
const text = `Failed deploying Edge Handlers: ${error_.message}`
|
|
80
|
-
stopSpinner({ spinner, text, error: true })
|
|
81
|
-
await cancelDeploy({ api, deployId })
|
|
82
|
-
// no need to report the error again
|
|
83
|
-
error('')
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
module.exports = { deployEdgeHandlers }
|