netlify-cli 12.5.0 → 12.6.0
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 +908 -582
- package/package.json +5 -159
- package/src/commands/deploy/deploy.mjs +1 -1
- package/src/commands/dev/dev.mjs +24 -11
- package/src/commands/env/env-list.mjs +1 -0
- package/src/commands/functions/functions-create.mjs +35 -25
- package/src/commands/sites/sites-list.mjs +1 -1
- package/src/commands/watch/watch.mjs +1 -1
- package/src/functions-templates/go/hello-world/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/apollo-graphql/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/apollo-graphql-rest/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/auth-fetch/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/create-user/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/fauna-crud/{.netlify-function-template.cjs → .netlify-function-template.mjs} +3 -2
- package/src/functions-templates/javascript/fauna-graphql/{.netlify-function-template.cjs → .netlify-function-template.mjs} +3 -2
- package/src/functions-templates/javascript/google-analytics/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/graphql-gateway/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/hasura-event-triggered/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/hello/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/{typescript/hello-world/.netlify-function-template.cjs → javascript/hello-world/.netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/identity-signup/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/image-external/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/localized-content/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/node-fetch/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/oauth-passport/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/protected-function/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/sanity-create/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/sanity-groq/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/scheduled-function/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/scheduled-function/package.json +1 -1
- package/src/functions-templates/javascript/send-email/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/serverless-ssr/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/set-cookie/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/set-cookies/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/{typescript/set-req-header/.netlify-function-template.cjs → javascript/set-req-header/.netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/set-res-header/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/slack-rate-limit/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/stripe-charge/{.netlify-function-template.cjs → .netlify-function-template.mjs} +2 -2
- package/src/functions-templates/javascript/stripe-subscription/{.netlify-function-template.cjs → .netlify-function-template.mjs} +2 -2
- package/src/functions-templates/javascript/submission-created/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/token-hider/{.netlify-function-template.cjs → .netlify-function-template.mjs} +2 -2
- package/src/functions-templates/{typescript/transform-response/.netlify-function-template.cjs → javascript/transform-response/.netlify-function-template.mjs} +1 -1
- package/src/functions-templates/javascript/url-shortener/{.netlify-function-template.cjs → .netlify-function-template.mjs} +2 -2
- package/src/functions-templates/javascript/using-middleware/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/rust/hello-world/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/typescript/abtest/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/typescript/geolocation/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/typescript/geolocation/{{name}}.ts +1 -1
- package/src/functions-templates/{javascript/hello-world/.netlify-function-template.cjs → typescript/hello-world/.netlify-function-template.mjs} +1 -1
- package/src/functions-templates/typescript/hello-world/package-lock.json +7 -7
- package/src/functions-templates/typescript/hello-world/package.json +1 -1
- package/src/functions-templates/typescript/json/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/typescript/json/{{name}}.ts +1 -1
- package/src/functions-templates/typescript/log/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/typescript/log/{{name}}.ts +2 -2
- package/src/functions-templates/typescript/scheduled-function/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/typescript/scheduled-function/package.json +1 -1
- package/src/functions-templates/typescript/set-cookies/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/{javascript/set-req-header/.netlify-function-template.cjs → typescript/set-req-header/.netlify-function-template.mjs} +1 -1
- package/src/functions-templates/typescript/set-res-header/{.netlify-function-template.cjs → .netlify-function-template.mjs} +1 -1
- package/src/functions-templates/{javascript/transform-response/.netlify-function-template.cjs → typescript/transform-response/.netlify-function-template.mjs} +1 -1
- package/src/lib/completion/constants.mjs +1 -1
- package/src/lib/edge-functions/deploy.mjs +1 -1
- package/src/lib/edge-functions/internal.mjs +1 -1
- package/src/lib/edge-functions/proxy.mjs +2 -2
- package/src/lib/{fs.cjs → fs.mjs} +5 -13
- package/src/lib/functions/runtimes/js/builders/netlify-lambda.mjs +1 -1
- package/src/lib/functions/runtimes/js/builders/zisi.mjs +1 -1
- package/src/lib/functions/runtimes/rust/index.mjs +1 -1
- package/src/lib/{settings.cjs → settings.mjs} +6 -8
- package/src/lib/{spinner.cjs → spinner.mjs} +5 -7
- package/src/utils/command-helpers.mjs +1 -1
- package/src/utils/dot-env.mjs +1 -1
- package/src/utils/functions/functions.mjs +2 -2
- package/src/utils/functions/get-functions.mjs +1 -1
- package/src/utils/get-global-config.mjs +1 -1
- package/src/utils/gitignore.mjs +1 -1
- package/src/utils/init/utils.mjs +1 -1
- package/src/utils/live-tunnel.mjs +1 -1
- package/src/utils/lm/install.mjs +2 -2
- package/src/utils/proxy.mjs +1 -1
- package/src/utils/rules-proxy.mjs +1 -1
- package/src/utils/state-config.mjs +1 -1
package/package.json
CHANGED
|
@@ -1,164 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.6.0",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"contributors": [
|
|
8
|
-
"@whitep4nth3r (https://twitter.com/whitep4nth3r)",
|
|
9
|
-
"Abraham Schilling <AbrahamSchilling@gmail.com> (https://gitlab.com/n4bb12)",
|
|
10
|
-
"Alberto De Agostini (https://twitter.com/albertodeago88)",
|
|
11
|
-
"Alejandro Ñáñez Ortiz <git@alejandro.dev> (https://twitter.com/alejandronanez)",
|
|
12
|
-
"Alex Reardon (https://twitter.com/alexandereardon)",
|
|
13
|
-
"Anees Iqbal <hello@aneesiqbal.me> (https://twitter.com/realsteelbrain)",
|
|
14
|
-
"Antonio Nuno Monteiro (https://twitter.com/_anmonteiro)",
|
|
15
|
-
"Ardie Wen",
|
|
16
|
-
"Arthur Puyou <arthur@puyou.fr> (https://twitter.com/apuyou)",
|
|
17
|
-
"Ashal Farhan",
|
|
18
|
-
"Battulga Tsogtgerel <theonlytulga@gmail.com>",
|
|
19
|
-
"Be <be.0@gmx.com> (https://beasintheverb.me/)",
|
|
20
|
-
"Benaiah Mischenko <benaiah@mischenko.com> (https://benaiah.me)",
|
|
21
|
-
"Björn Clees <piranhadev@gmail.com> (https://linkedin.com/in/bjoern-clees/en)",
|
|
22
|
-
"Bob",
|
|
23
|
-
"Bret Comnes <bcomnes@gmail.com> (https://bret.io)",
|
|
24
|
-
"Brett DeWoody <brettdewoody@gmail.com> (https://twitter.com/brettdewoody)",
|
|
25
|
-
"C. Lewis (https://twitter.com/ctjlewis)",
|
|
26
|
-
"Caleb (https://caleblarsen.dev)",
|
|
27
|
-
"Cassidy Williams (https://twitter.com/cassidoo)",
|
|
28
|
-
"Charlie Depman <cdepman@gmail.com> (depman.dev)",
|
|
29
|
-
"Charlie Depman <cdepman@gmail.com> (depman.dev)",
|
|
30
|
-
"Charlie Depman <cdepman@gmail.com> (depman.dev)",
|
|
31
|
-
"Chris Templin <ctemplin@gmail.com>",
|
|
32
|
-
"Cole Bosmann",
|
|
33
|
-
"Dan Croak (https://twitter.com/croaky)",
|
|
34
|
-
"Dan Loewenherz <dan@lionheartsw.com> (https://twitter.com/dwlz)",
|
|
35
|
-
"Daniel Tschinder (https://twitter.com/TschinderDaniel)",
|
|
36
|
-
"Daniel Woelfel <dwwoelfel@gmail.com> (https://twitter.com/danielwoelfel)",
|
|
37
|
-
"Dario De Vito",
|
|
38
|
-
"Dave Ackerman <dmackerman@gmail.com>",
|
|
39
|
-
"David Calavera <david@netlify.com> (https://twitter.com/calavera)",
|
|
40
|
-
"David Lemler <dlemler@pm.me> (https://twitter.com/davidlemlerm)",
|
|
41
|
-
"David Thyresson (https://twitter.com/dthyresson)",
|
|
42
|
-
"David Wells <david.wells@netlify.com> (https://davidwells.io/)",
|
|
43
|
-
"Devin Fitzsimons (https://twitter.com/fitzsimons_dev)",
|
|
44
|
-
"Eddie <eddiecooro@gmail.com> (https://www.linkedin.com/in/ali-rezaie-farahani-3b435611a)",
|
|
45
|
-
"Eduardo Bouças <mail@eduardoboucas.com> (https://twitter.com/eduardoboucas)",
|
|
46
|
-
"Emily Zhang (https://twitter.com/mlylzhng)",
|
|
47
|
-
"Erez Rokah (https://www.erezro.com)",
|
|
48
|
-
"Erica Pisani <pisani.erica@gmail.com>",
|
|
49
|
-
"Evans Hauser (https://twitter.com/evanshauser)",
|
|
50
|
-
"Ewan Valentine <ewan.valentine89@gmail.com> (http://ewanvalentine.io)",
|
|
51
|
-
"Finn Woelm (https://twitter.com/FinnWoelm)",
|
|
52
|
-
"Flxbot",
|
|
53
|
-
"Gavin Henderson <gavin.henderson@hotmail.co.uk> (https://twitter.com/gavinhenderson5)",
|
|
54
|
-
"Gergely Nemeth (https://twitter.com/nthgergo)",
|
|
55
|
-
"HonkingGoose",
|
|
56
|
-
"Ian Martorell <ianmartorell@gmail.com>",
|
|
57
|
-
"Ibrahima G. Coulibaly",
|
|
58
|
-
"Jackie Macharia (wangoimacharia.dev)",
|
|
59
|
-
"Jacob Schatz",
|
|
60
|
-
"Jake Jarvis <jake@jarv.is> (https://twitter.com/jakejarvis)",
|
|
61
|
-
"Jakob Warkotsch <j.warkotsch@gmail.com>",
|
|
62
|
-
"James George (https://twitter.com/james_madhacks)",
|
|
63
|
-
"Jason Barry (https://twitter.com/jasbarry)",
|
|
64
|
-
"Jason Lengstorf <jason@lengstorf.com> (https://twitter.com/jlengstorf)",
|
|
65
|
-
"Jenae Janzen",
|
|
66
|
-
"Jeremy Monson (www.surfline.com)",
|
|
67
|
-
"Jessica Parsons",
|
|
68
|
-
"Jhey Tompkins (https://twitter.com/jh3yy)",
|
|
69
|
-
"Jon Sullivan <hey@jonsully.net> (https://jonsully.net)",
|
|
70
|
-
"Jonas Brusman (https://jonas.brusman.se)",
|
|
71
|
-
"Jonathan Cardoso <me@jonathancardoso.com> (https://twitter.com/_jonathancardos)",
|
|
72
|
-
"Jordan Whistler (www.jordanwhistler.info)",
|
|
73
|
-
"Joshua T. (http://localhost:8080)",
|
|
74
|
-
"João Antunes <me@jgantunes.com> (https://twitter.com/jgantunes)",
|
|
75
|
-
"Karagulamos (https://twitter.com/karagulamos)",
|
|
76
|
-
"Karin Hendrikse <khendrikse.netlify.app>",
|
|
77
|
-
"Kaspar Emanuel <kaspar@monostable.co.uk> (https://twitter.com/kaspar_e)",
|
|
78
|
-
"Keiko Oda (https://keikooda.net/)",
|
|
79
|
-
"Krasimir Nedelchev (https://github.com/kaykayehnn)",
|
|
80
|
-
"Kunal Kundu (https://twitter.com/kunal__kundu)",
|
|
81
|
-
"Kyle Rollins <kyleblankrollins@gmail.com> (kyleblankrollins.com)",
|
|
82
|
-
"Lana Vorozheykina",
|
|
83
|
-
"Leon Hennings",
|
|
84
|
-
"Liran Tal <liran.tal@gmail.com> (https://twitter.com/liran_tal)",
|
|
85
|
-
"Louis DeScioli (https://twitter.com/descioli)",
|
|
86
|
-
"Lukas Holzer <lukas.holzer@netlify.com> (https://twitter.com/luka5c0m)",
|
|
87
|
-
"Lxxyx <Lxxyxzj@gmail.com> (https://twitter.com/Lxxyx_)",
|
|
88
|
-
"Marc Littlemore (https://twitter.com/marclittlemore)",
|
|
89
|
-
"Marcus Weiner",
|
|
90
|
-
"Mark Bello <mark@markbello.dev> (https://markbello.dev)",
|
|
91
|
-
"Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
|
|
92
|
-
"Matt Messinger <messinger.matt@gmail.com>",
|
|
93
|
-
"Maximilian Berkmann <maxieberkmann@gmail.com> (https://twitter.com/Berkmann18)",
|
|
94
|
-
"MentalGear <tomfaber7@gmail.com>",
|
|
95
|
-
"Moritz Gunz <hello@moritzgunz.de> (https://moritzgunz.de)",
|
|
96
|
-
"Muhammad Javed <theahmadzai@gmail.com> (https://twitter.com/theahmadzai786)",
|
|
97
|
-
"Munif Tanjim <github@muniftanjim.dev> (https://twitter.com/MunifTanjim)",
|
|
98
|
-
"Nestor Vera <nestorvera@me.com> (https://twitter.com/hack_nug)",
|
|
99
|
-
"Netlify Team Account 1 (https://twitter.com/netlify)",
|
|
100
|
-
"Nick McCurdy <nick@nickmccurdy.com> (https://twitter.com/nickemccurdy)",
|
|
101
|
-
"Nick Taylor <nick@iamdeveloper.com> (https://twitter.com/nickytonline)",
|
|
102
|
-
"Nicolas Gonzalez",
|
|
103
|
-
"Pankaj Patil <pankaj.patil2099@hotmail.com> (https://twitter.com/pankajpatil16)",
|
|
104
|
-
"Peter",
|
|
105
|
-
"Prince Wilson (https://twitter.com/maxcell)",
|
|
106
|
-
"Rachael Stavchansky",
|
|
107
|
-
"Raees Iqbal <raees@netlify.com> (https://raeesbhatti.com/)",
|
|
108
|
-
"Ricardo Mendes <rokusu@gmail.com> (https://twitter.com/locks)",
|
|
109
|
-
"Robert Martin <rmartin@rmart.in>",
|
|
110
|
-
"Robin Hoodie",
|
|
111
|
-
"Rodney Coyer <rodney.coyer@gmail.com>",
|
|
112
|
-
"Rohit J (https://twitter.com/syntaxhacker0)",
|
|
113
|
-
"Roneo.org (Roneo.org)",
|
|
114
|
-
"Rui Ramos <ruiramos@gmail.com> (https://ruiramos.com)",
|
|
115
|
-
"Rune Botten <rbotten@gmail.com> (https://twitter.com/runeb)",
|
|
116
|
-
"Russell Davis (https://twitter.com/_RussellDavis)",
|
|
117
|
-
"Ryan Neal",
|
|
118
|
-
"Sam Holmes <samholmes1337@gmail.com> (https://samholmes.net)",
|
|
119
|
-
"Sander de Groot (https://degroot.dev)",
|
|
120
|
-
"Sarah Drasner <sarah.drasner@gmail.com> (https://twitter.com/sarah_edo)",
|
|
121
|
-
"Sarah Etter <sarah@sarahetter.com> (http://www.sarahetter.com)",
|
|
122
|
-
"Scott Spence <spences10apps@gmail.com> (https://twitter.com/spences10)",
|
|
123
|
-
"Sean Grove <sean@bushi.do> (https://twitter.com/sgrove)",
|
|
124
|
-
"Sebastian Smolorz",
|
|
125
|
-
"Semyon Tokarev (https://zobzn.com/)",
|
|
126
|
-
"Sergii Zinkevych",
|
|
127
|
-
"Shawn Erquhart <shawn@erquh.art>",
|
|
128
|
-
"Shawn Makinson (http://smakinson.github.io)",
|
|
129
|
-
"Simon Knott <info@simonknott.de> (https://twitter.com/skn0tt)",
|
|
130
|
-
"Souma Suzuki <subayai.kobashiri@gmail.com>",
|
|
131
|
-
"Sven Serlier (dypodex.nl/sven/)",
|
|
132
|
-
"Sébastien Chopin <seb@nuxtjs.com> (https://twitter.com/Atinux)",
|
|
133
|
-
"Takumi Hirunuma <m.111_t.1230_nittc@outlook.com> (https://twitter.com/mg111_)",
|
|
134
|
-
"Tan Zhen Yong (https://www.beyondthesprawl.com)",
|
|
135
|
-
"Tara Z. Manicsic <tzmanics@gmail.com> (https://tzmanics.dev)",
|
|
136
|
-
"Thai Pangsakulyanont (https://dt.in.th/)",
|
|
137
|
-
"Tiffany Le-Nguyen (https://twitter.com/tiffanosaurus)",
|
|
138
|
-
"Tim Culverhouse <tim@timculverhouse.com> (www.timculverhouse.com)",
|
|
139
|
-
"Tim Perry (https://twitter.com/pimterry)",
|
|
140
|
-
"Tim Trautman (timtrautman.com)",
|
|
141
|
-
"Tom Dyson (https://wagtail.io/)",
|
|
142
|
-
"Tom Hu (https://twitter.com/thomasrockhu)",
|
|
143
|
-
"Travis Horn <travis@travishorn.com> (https://twitter.com/horn_travis)",
|
|
144
|
-
"Try Ajitiono <ballinst@gmail.com> (https://twitter.com/Ajiballinst)",
|
|
145
|
-
"Victor Dadfar",
|
|
146
|
-
"Wayne (https://twitter.com/waynehoover_)",
|
|
147
|
-
"XhmikosR <xhmikosr@gmail.com> (https://twitter.com/xhmikosr)",
|
|
148
|
-
"Ximena Sandoval <ximena.sandoval.dh@gmail.com> (https://ximenasandoval.github.io)",
|
|
149
|
-
"Yuvi Panda",
|
|
150
|
-
"cesare soldini <cesare.soldini@gmail.com>",
|
|
151
|
-
"chris (fool) mccraw (http://twitter.com/fool)",
|
|
152
|
-
"dustincrogers",
|
|
153
|
-
"eddie",
|
|
154
|
-
"ehmicky (https://twitter.com/ehmicky)",
|
|
155
|
-
"internal tools netlibot",
|
|
156
|
-
"kvn-shn",
|
|
157
|
-
"netlibot (https://www.netlify.com)",
|
|
158
|
-
"nikoladev",
|
|
159
|
-
"polemius",
|
|
160
|
-
"swyx <shawnthe1@gmail.com> (https://twitter.com/swyx)"
|
|
161
|
-
],
|
|
162
7
|
"engines": {
|
|
163
8
|
"node": "^14.16.0 || >=16.0.0"
|
|
164
9
|
},
|
|
@@ -230,8 +75,9 @@
|
|
|
230
75
|
"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\" \"!**/*/package-lock.json\" \"!.github/**/*.md\""
|
|
231
76
|
},
|
|
232
77
|
"dependencies": {
|
|
233
|
-
"@
|
|
234
|
-
"@netlify/
|
|
78
|
+
"@fastify/static": "^6.6.0",
|
|
79
|
+
"@netlify/build": "^29.4.0",
|
|
80
|
+
"@netlify/config": "^20.3.0",
|
|
235
81
|
"@netlify/edge-bundler": "^8.0.0",
|
|
236
82
|
"@netlify/framework-info": "^9.5.3",
|
|
237
83
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
@@ -265,6 +111,7 @@
|
|
|
265
111
|
"execa": "^5.0.0",
|
|
266
112
|
"express": "^4.17.1",
|
|
267
113
|
"express-logging": "^1.1.1",
|
|
114
|
+
"fastify": "^4.10.2",
|
|
268
115
|
"find-up": "^5.0.0",
|
|
269
116
|
"flush-write-stream": "^2.0.0",
|
|
270
117
|
"folder-walker": "^3.2.0",
|
|
@@ -316,7 +163,6 @@
|
|
|
316
163
|
"read-pkg-up": "^7.0.1",
|
|
317
164
|
"semver": "^7.3.5",
|
|
318
165
|
"source-map-support": "^0.5.19",
|
|
319
|
-
"static-server": "^2.2.1",
|
|
320
166
|
"string-similarity": "^4.0.4",
|
|
321
167
|
"strip-ansi-control-characters": "^2.0.0",
|
|
322
168
|
"tabtab": "^3.0.2",
|
|
@@ -15,7 +15,7 @@ import { getBuildOptions, runBuild } from '../../lib/build.mjs'
|
|
|
15
15
|
import { featureFlags as edgeFunctionsFeatureFlags } from '../../lib/edge-functions/consts.mjs'
|
|
16
16
|
import { normalizeFunctionsConfig } from '../../lib/functions/config.mjs'
|
|
17
17
|
import { getLogMessage } from '../../lib/log.mjs'
|
|
18
|
-
import { startSpinner, stopSpinner } from '../../lib/spinner.
|
|
18
|
+
import { startSpinner, stopSpinner } from '../../lib/spinner.mjs'
|
|
19
19
|
import {
|
|
20
20
|
chalk,
|
|
21
21
|
error,
|
package/src/commands/dev/dev.mjs
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import events from 'events'
|
|
3
3
|
import path from 'path'
|
|
4
4
|
import process from 'process'
|
|
5
|
-
import { promisify } from 'util'
|
|
6
5
|
|
|
6
|
+
import fastifyStatic from '@fastify/static'
|
|
7
7
|
import boxen from 'boxen'
|
|
8
8
|
import { Option } from 'commander'
|
|
9
9
|
import execa from 'execa'
|
|
10
|
-
import
|
|
10
|
+
import Fastify from 'fastify'
|
|
11
11
|
import stripAnsiCc from 'strip-ansi-control-characters'
|
|
12
12
|
import waitPort from 'wait-port'
|
|
13
13
|
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
getNetlifyGraphConfig,
|
|
27
27
|
readGraphQLOperationsSourceFile,
|
|
28
28
|
} from '../../lib/one-graph/cli-netlify-graph.mjs'
|
|
29
|
-
import { startSpinner, stopSpinner } from '../../lib/spinner.
|
|
29
|
+
import { startSpinner, stopSpinner } from '../../lib/spinner.mjs'
|
|
30
30
|
import {
|
|
31
31
|
BANG,
|
|
32
32
|
chalk,
|
|
@@ -55,16 +55,29 @@ import { createDevExecCommand } from './dev-exec.mjs'
|
|
|
55
55
|
const netlifyBuildPromise = import('@netlify/build')
|
|
56
56
|
|
|
57
57
|
const startStaticServer = async ({ settings }) => {
|
|
58
|
-
const server =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
const server = Fastify()
|
|
59
|
+
const rootPath = path.resolve(settings.dist)
|
|
60
|
+
server.register(fastifyStatic, {
|
|
61
|
+
root: rootPath,
|
|
62
|
+
etag: false,
|
|
63
|
+
acceptRanges: false,
|
|
64
|
+
lastModified: false,
|
|
65
65
|
})
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
server.setNotFoundHandler((_req, res) => {
|
|
68
|
+
res.code(404).sendFile('404.html', rootPath)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
server.addHook('onRequest', (req, reply, done) => {
|
|
72
|
+
reply.header('X-Powered-by', 'netlify-dev')
|
|
73
|
+
const validMethods = ['GET', 'HEAD']
|
|
74
|
+
if (!validMethods.includes(req.method)) {
|
|
75
|
+
reply.code(405).send('Method Not Allowed')
|
|
76
|
+
}
|
|
77
|
+
done()
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
await server.listen({ port: settings.frameworkPort })
|
|
68
81
|
log(`\n${NETLIFYDEVLOG} Static server listening to`, settings.frameworkPort)
|
|
69
82
|
}
|
|
70
83
|
|
|
@@ -134,6 +134,7 @@ export const createEnvListCommand = (program) =>
|
|
|
134
134
|
normalizeContext,
|
|
135
135
|
'dev',
|
|
136
136
|
)
|
|
137
|
+
.option('--json', 'Output environment variables as JSON')
|
|
137
138
|
.addOption(new Option('--plain', 'Output environment variables as plaintext').conflicts('json'))
|
|
138
139
|
.addOption(
|
|
139
140
|
new Option('-s, --scope <scope>', 'Specify a scope')
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import cp from 'child_process'
|
|
3
3
|
import fs from 'fs'
|
|
4
|
-
import { mkdir } from 'fs/promises'
|
|
4
|
+
import { mkdir, readdir, unlink } from 'fs/promises'
|
|
5
5
|
import { createRequire } from 'module'
|
|
6
6
|
import path, { dirname } from 'path'
|
|
7
7
|
import process from 'process'
|
|
8
|
-
import { fileURLToPath } from 'url'
|
|
8
|
+
import { fileURLToPath, pathToFileURL } from 'url'
|
|
9
9
|
import { promisify } from 'util'
|
|
10
10
|
|
|
11
11
|
import copyTemplateDirOriginal from 'copy-template-dir'
|
|
@@ -16,6 +16,7 @@ import inquirerAutocompletePrompt from 'inquirer-autocomplete-prompt'
|
|
|
16
16
|
import fetch from 'node-fetch'
|
|
17
17
|
import ora from 'ora'
|
|
18
18
|
|
|
19
|
+
import { fileExistsAsync } from '../../lib/fs.mjs'
|
|
19
20
|
import { getAddons, getCurrentAddon, getSiteData } from '../../utils/addons/prepare.mjs'
|
|
20
21
|
import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, error, log } from '../../utils/command-helpers.mjs'
|
|
21
22
|
import { injectEnvVariables } from '../../utils/dev.mjs'
|
|
@@ -90,19 +91,26 @@ const filterRegistry = function (registry, input) {
|
|
|
90
91
|
})
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
const formatRegistryArrayForInquirer = function (lang, funcType) {
|
|
94
|
-
const folderNames =
|
|
95
|
-
const registry = folderNames
|
|
96
|
-
// filter out markdown files
|
|
97
|
-
.filter((folderName) => !folderName.endsWith('.md'))
|
|
94
|
+
const formatRegistryArrayForInquirer = async function (lang, funcType) {
|
|
95
|
+
const folderNames = await readdir(path.join(templatesDir, lang))
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
const imports = await Promise.all(
|
|
98
|
+
folderNames
|
|
99
|
+
// filter out markdown files
|
|
100
|
+
.filter((folderName) => !folderName.endsWith('.md'))
|
|
101
|
+
.map(async (folderName) => {
|
|
102
|
+
const templatePath = path.join(templatesDir, lang, folderName, '.netlify-function-template.mjs')
|
|
103
|
+
// eslint-disable-next-line import/no-dynamic-require
|
|
104
|
+
const template = await import(pathToFileURL(templatePath))
|
|
105
|
+
|
|
106
|
+
return template.default
|
|
107
|
+
}),
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
const registry = imports
|
|
111
|
+
.filter((template) => template.functionType === funcType)
|
|
112
|
+
.sort((templateA, templateB) => {
|
|
113
|
+
const priorityDiff = (templateA.priority || DEFAULT_PRIORITY) - (templateB.priority || DEFAULT_PRIORITY)
|
|
106
114
|
|
|
107
115
|
if (priorityDiff !== 0) {
|
|
108
116
|
return priorityDiff
|
|
@@ -112,7 +120,7 @@ const formatRegistryArrayForInquirer = function (lang, funcType) {
|
|
|
112
120
|
// until Node 11, so the original sorting order from `fs.readdirSync`
|
|
113
121
|
// was not respected. We can simplify this once we drop support for
|
|
114
122
|
// Node 10.
|
|
115
|
-
return
|
|
123
|
+
return templateA - templateB
|
|
116
124
|
})
|
|
117
125
|
.map((t) => {
|
|
118
126
|
t.lang = lang
|
|
@@ -170,7 +178,7 @@ const pickTemplate = async function ({ language: languageFromFlag }, funcType) {
|
|
|
170
178
|
let templatesForLanguage
|
|
171
179
|
|
|
172
180
|
try {
|
|
173
|
-
templatesForLanguage = formatRegistryArrayForInquirer(language, funcType)
|
|
181
|
+
templatesForLanguage = await formatRegistryArrayForInquirer(language, funcType)
|
|
174
182
|
} catch {
|
|
175
183
|
throw error(`Invalid language: ${language}`)
|
|
176
184
|
}
|
|
@@ -292,14 +300,14 @@ const ensureFunctionDirExists = async function (command) {
|
|
|
292
300
|
}
|
|
293
301
|
}
|
|
294
302
|
|
|
295
|
-
if (!
|
|
303
|
+
if (!(await fileExistsAsync(functionsDirHolder))) {
|
|
296
304
|
log(
|
|
297
305
|
`${NETLIFYDEVLOG} functions directory ${chalk.magenta.inverse(
|
|
298
306
|
functionsDirHolder,
|
|
299
307
|
)} does not exist yet, creating it...`,
|
|
300
308
|
)
|
|
301
309
|
|
|
302
|
-
|
|
310
|
+
await mkdir(functionsDirHolder, { recursive: true })
|
|
303
311
|
|
|
304
312
|
log(`${NETLIFYDEVLOG} functions directory ${chalk.magenta.inverse(functionsDirHolder)} created`)
|
|
305
313
|
}
|
|
@@ -350,15 +358,17 @@ const downloadFromURL = async function (command, options, argumentName, function
|
|
|
350
358
|
})
|
|
351
359
|
|
|
352
360
|
// read, execute, and delete function template file if exists
|
|
353
|
-
const fnTemplateFile = path.join(fnFolder, '.netlify-function-template.
|
|
354
|
-
if (
|
|
355
|
-
|
|
356
|
-
|
|
361
|
+
const fnTemplateFile = path.join(fnFolder, '.netlify-function-template.mjs')
|
|
362
|
+
if (await fileExistsAsync(fnTemplateFile)) {
|
|
363
|
+
const {
|
|
364
|
+
default: { onComplete, addons = [] },
|
|
365
|
+
// eslint-disable-next-line import/no-dynamic-require
|
|
366
|
+
} = await import(pathToFileURL(fnTemplateFile).href)
|
|
357
367
|
|
|
358
368
|
await installAddons(command, addons, path.resolve(fnFolder))
|
|
359
369
|
await handleOnComplete({ command, onComplete })
|
|
360
370
|
// delete
|
|
361
|
-
|
|
371
|
+
await unlink(fnTemplateFile)
|
|
362
372
|
}
|
|
363
373
|
}
|
|
364
374
|
|
|
@@ -471,7 +481,7 @@ const scaffoldFromTemplate = async function (command, options, argumentName, fun
|
|
|
471
481
|
|
|
472
482
|
// These files will not be part of the log message because they'll likely
|
|
473
483
|
// be removed before the command finishes.
|
|
474
|
-
const omittedFromOutput = new Set(['.netlify-function-template.
|
|
484
|
+
const omittedFromOutput = new Set(['.netlify-function-template.mjs', 'package.json', 'package-lock.json'])
|
|
475
485
|
const createdFiles = await copyTemplateDir(pathToTemplate, functionPath, vars)
|
|
476
486
|
createdFiles.forEach((filePath) => {
|
|
477
487
|
const filename = path.basename(filePath)
|
|
@@ -487,7 +497,7 @@ const scaffoldFromTemplate = async function (command, options, argumentName, fun
|
|
|
487
497
|
})
|
|
488
498
|
|
|
489
499
|
// delete function template file that was copied over by copydir
|
|
490
|
-
|
|
500
|
+
await unlink(path.join(functionPath, '.netlify-function-template.mjs'))
|
|
491
501
|
|
|
492
502
|
// npm install
|
|
493
503
|
if (functionPackageJson !== undefined) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { listSites } from '../../lib/api.mjs'
|
|
3
|
-
import { startSpinner, stopSpinner } from '../../lib/spinner.
|
|
3
|
+
import { startSpinner, stopSpinner } from '../../lib/spinner.mjs'
|
|
4
4
|
import { chalk, log, logJson } from '../../utils/command-helpers.mjs'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import pWaitFor from 'p-wait-for'
|
|
3
3
|
import prettyjson from 'prettyjson'
|
|
4
4
|
|
|
5
|
-
import { startSpinner, stopSpinner } from '../../lib/spinner.
|
|
5
|
+
import { startSpinner, stopSpinner } from '../../lib/spinner.mjs'
|
|
6
6
|
import { chalk, error, log } from '../../utils/command-helpers.mjs'
|
|
7
7
|
import { init } from '../init/index.mjs'
|
|
8
8
|
|