Skip to content

Commit 16376e9

Browse files
danezkodiakhq[bot]
andauthored
chore: migrate everything to ESM (#5345)
* chore: migrate all to esm * chore: migrate functions templates to esm * chore: increase hook timeout * chore: fix windows * chore: increase timeout * chore: skip test Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 21d9191 commit 16376e9

File tree

86 files changed

+1099
-1072
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1099
-1072
lines changed

docs/netlify-dev.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ to do it for you.
304304
**Writing your own Function Templates**
305305
306306
Function templates can specify `addons` that they rely on as well as execute arbitrary code after installation in an
307-
`onComplete` hook, if a special `.netlify-function-template.js` file exists in the directory:
307+
`onComplete` hook, if a special `.netlify-function-template.mjs` file exists in the directory:
308308
309309
```js
310-
// .netlify-function-template.js
311-
module.exports = {
310+
// .netlify-function-template.mjs
311+
export default {
312312
addons: [
313313
{
314314
addonName: 'fauna',

src/commands/deploy/deploy.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { getBuildOptions, runBuild } from '../../lib/build.mjs'
1515
import { featureFlags as edgeFunctionsFeatureFlags } from '../../lib/edge-functions/consts.mjs'
1616
import { normalizeFunctionsConfig } from '../../lib/functions/config.mjs'
1717
import { getLogMessage } from '../../lib/log.mjs'
18-
import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
18+
import { startSpinner, stopSpinner } from '../../lib/spinner.mjs'
1919
import {
2020
chalk,
2121
error,

src/commands/dev/dev.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
getNetlifyGraphConfig,
2727
readGraphQLOperationsSourceFile,
2828
} from '../../lib/one-graph/cli-netlify-graph.mjs'
29-
import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
29+
import { startSpinner, stopSpinner } from '../../lib/spinner.mjs'
3030
import {
3131
BANG,
3232
chalk,

src/commands/functions/functions-create.mjs

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// @ts-check
22
import cp from 'child_process'
33
import fs from 'fs'
4-
import { mkdir } from 'fs/promises'
4+
import { mkdir, readdir, unlink } from 'fs/promises'
55
import { createRequire } from 'module'
66
import path, { dirname } from 'path'
77
import process from 'process'
8-
import { fileURLToPath } from 'url'
8+
import { fileURLToPath, pathToFileURL } from 'url'
99
import { promisify } from 'util'
1010

1111
import copyTemplateDirOriginal from 'copy-template-dir'
@@ -16,6 +16,7 @@ import inquirerAutocompletePrompt from 'inquirer-autocomplete-prompt'
1616
import fetch from 'node-fetch'
1717
import ora from 'ora'
1818

19+
import { fileExistsAsync } from '../../lib/fs.mjs'
1920
import { getAddons, getCurrentAddon, getSiteData } from '../../utils/addons/prepare.mjs'
2021
import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, error, log } from '../../utils/command-helpers.mjs'
2122
import { injectEnvVariables } from '../../utils/dev.mjs'
@@ -90,19 +91,26 @@ const filterRegistry = function (registry, input) {
9091
})
9192
}
9293

93-
const formatRegistryArrayForInquirer = function (lang, funcType) {
94-
const folderNames = fs.readdirSync(path.join(templatesDir, lang))
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))
9896

99-
.map((folderName) =>
100-
// eslint-disable-next-line import/no-dynamic-require
101-
require(path.join(templatesDir, lang, folderName, '.netlify-function-template.cjs')),
102-
)
103-
.filter((folderName) => folderName.functionType === funcType)
104-
.sort((folderNameA, folderNameB) => {
105-
const priorityDiff = (folderNameA.priority || DEFAULT_PRIORITY) - (folderNameB.priority || DEFAULT_PRIORITY)
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)
106114

107115
if (priorityDiff !== 0) {
108116
return priorityDiff
@@ -112,7 +120,7 @@ const formatRegistryArrayForInquirer = function (lang, funcType) {
112120
// until Node 11, so the original sorting order from `fs.readdirSync`
113121
// was not respected. We can simplify this once we drop support for
114122
// Node 10.
115-
return folderNameA - folderNameB
123+
return templateA - templateB
116124
})
117125
.map((t) => {
118126
t.lang = lang
@@ -170,7 +178,7 @@ const pickTemplate = async function ({ language: languageFromFlag }, funcType) {
170178
let templatesForLanguage
171179

172180
try {
173-
templatesForLanguage = formatRegistryArrayForInquirer(language, funcType)
181+
templatesForLanguage = await formatRegistryArrayForInquirer(language, funcType)
174182
} catch {
175183
throw error(`Invalid language: ${language}`)
176184
}
@@ -292,14 +300,14 @@ const ensureFunctionDirExists = async function (command) {
292300
}
293301
}
294302

295-
if (!fs.existsSync(functionsDirHolder)) {
303+
if (!(await fileExistsAsync(functionsDirHolder))) {
296304
log(
297305
`${NETLIFYDEVLOG} functions directory ${chalk.magenta.inverse(
298306
functionsDirHolder,
299307
)} does not exist yet, creating it...`,
300308
)
301309

302-
fs.mkdirSync(functionsDirHolder, { recursive: true })
310+
await mkdir(functionsDirHolder, { recursive: true })
303311

304312
log(`${NETLIFYDEVLOG} functions directory ${chalk.magenta.inverse(functionsDirHolder)} created`)
305313
}
@@ -350,15 +358,17 @@ const downloadFromURL = async function (command, options, argumentName, function
350358
})
351359

352360
// read, execute, and delete function template file if exists
353-
const fnTemplateFile = path.join(fnFolder, '.netlify-function-template.cjs')
354-
if (fs.existsSync(fnTemplateFile)) {
355-
// eslint-disable-next-line import/no-dynamic-require
356-
const { onComplete, addons = [] } = require(fnTemplateFile)
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)
357367

358368
await installAddons(command, addons, path.resolve(fnFolder))
359369
await handleOnComplete({ command, onComplete })
360370
// delete
361-
fs.unlinkSync(fnTemplateFile)
371+
await unlink(fnTemplateFile)
362372
}
363373
}
364374

@@ -471,7 +481,7 @@ const scaffoldFromTemplate = async function (command, options, argumentName, fun
471481

472482
// These files will not be part of the log message because they'll likely
473483
// be removed before the command finishes.
474-
const omittedFromOutput = new Set(['.netlify-function-template.cjs', 'package.json', 'package-lock.json'])
484+
const omittedFromOutput = new Set(['.netlify-function-template.mjs', 'package.json', 'package-lock.json'])
475485
const createdFiles = await copyTemplateDir(pathToTemplate, functionPath, vars)
476486
createdFiles.forEach((filePath) => {
477487
const filename = path.basename(filePath)
@@ -487,7 +497,7 @@ const scaffoldFromTemplate = async function (command, options, argumentName, fun
487497
})
488498

489499
// delete function template file that was copied over by copydir
490-
fs.unlinkSync(path.join(functionPath, '.netlify-function-template.cjs'))
500+
await unlink(path.join(functionPath, '.netlify-function-template.mjs'))
491501

492502
// npm install
493503
if (functionPackageJson !== undefined) {

src/commands/sites/sites-list.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22
import { listSites } from '../../lib/api.mjs'
3-
import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
3+
import { startSpinner, stopSpinner } from '../../lib/spinner.mjs'
44
import { chalk, log, logJson } from '../../utils/command-helpers.mjs'
55

66
/**

src/commands/watch/watch.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pWaitFor from 'p-wait-for'
33
import prettyjson from 'prettyjson'
44

5-
import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
5+
import { startSpinner, stopSpinner } from '../../lib/spinner.mjs'
66
import { chalk, error, log } from '../../utils/command-helpers.mjs'
77
import { init } from '../init/index.mjs'
88

src/functions-templates/go/hello-world/.netlify-function-template.cjs renamed to src/functions-templates/go/hello-world/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'hello-world',
33
priority: 1,
44
description: 'Basic function that shows how to create a handler and return a response',

src/functions-templates/javascript/apollo-graphql-rest/.netlify-function-template.cjs renamed to src/functions-templates/javascript/apollo-graphql-rest/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'apollo-graphql-rest',
33
description: 'GraphQL function to wrap REST API using apollo-server-lambda and apollo-datasource-rest!',
44
functionType: 'serverless',

src/functions-templates/javascript/apollo-graphql/.netlify-function-template.cjs renamed to src/functions-templates/javascript/apollo-graphql/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'apollo-graphql',
33
description: 'GraphQL function using Apollo-Server-Lambda!',
44
functionType: 'serverless',

src/functions-templates/javascript/auth-fetch/.netlify-function-template.cjs renamed to src/functions-templates/javascript/auth-fetch/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'auth-fetch',
33
description: 'Use `node-fetch` library and Netlify Identity to access APIs',
44
functionType: 'serverless',

src/functions-templates/javascript/create-user/.netlify-function-template.cjs renamed to src/functions-templates/javascript/create-user/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'create-user',
33
description: 'Programmatically create a Netlify Identity user by invoking a function',
44
functionType: 'serverless',

src/functions-templates/javascript/fauna-crud/.netlify-function-template.cjs renamed to src/functions-templates/javascript/fauna-crud/.netlify-function-template.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
const execa = require('execa')
2-
module.exports = {
1+
import execa from 'execa'
2+
3+
export default {
34
name: 'fauna-crud',
45
description: 'CRUD function using Fauna DB',
56
functionType: 'serverless',

src/functions-templates/javascript/fauna-graphql/.netlify-function-template.cjs renamed to src/functions-templates/javascript/fauna-graphql/.netlify-function-template.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
const execa = require('execa')
2-
module.exports = {
1+
import execa from 'execa'
2+
3+
export default {
34
name: 'fauna-graphql',
45
description: 'GraphQL Backend using Fauna DB',
56
functionType: 'serverless',

src/functions-templates/javascript/google-analytics/.netlify-function-template.cjs renamed to src/functions-templates/javascript/google-analytics/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'google-analytics',
33
description: 'Google Analytics: proxy for GA on your domain to avoid adblock',
44
functionType: 'serverless',

src/functions-templates/javascript/graphql-gateway/.netlify-function-template.cjs renamed to src/functions-templates/javascript/graphql-gateway/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'graphql-gateway',
33
description: 'Apollo Server Lambda Gateway stitching schemas from other GraphQL Functions!',
44
functionType: 'serverless',

src/functions-templates/javascript/hasura-event-triggered/.netlify-function-template.cjs renamed to src/functions-templates/javascript/hasura-event-triggered/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'hasura-event-triggered',
33
description: 'Hasura Cleaning: process a Hasura event and fire off a GraphQL mutation with processed text data',
44
functionType: 'serverless',

src/functions-templates/typescript/hello-world/.netlify-function-template.cjs renamed to src/functions-templates/javascript/hello-world/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'hello-world',
33
priority: 1,
44
description: 'Basic function that shows async/await usage, and response formatting',

src/functions-templates/javascript/hello/.netlify-function-template.cjs renamed to src/functions-templates/javascript/hello/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'hello',
33
description: 'Basic function that shows async/await usage, and response formatting',
44
functionType: 'edge',

src/functions-templates/javascript/identity-signup/.netlify-function-template.cjs renamed to src/functions-templates/javascript/identity-signup/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'identity-signup',
33
description: 'Identity Signup: Triggered when a new Netlify Identity user confirms. Assigns roles and extra metadata',
44
functionType: 'serverless',

src/functions-templates/javascript/image-external/.netlify-function-template.cjs renamed to src/functions-templates/javascript/image-external/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'image-external',
33
description: 'Fetches and serves an image from an external site',
44
functionType: 'edge',

src/functions-templates/javascript/localized-content/.netlify-function-template.cjs renamed to src/functions-templates/javascript/localized-content/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'localized-content',
33
description: 'Uses geolocation data to serve localized countent according to country code',
44
functionType: 'edge',

src/functions-templates/javascript/node-fetch/.netlify-function-template.cjs renamed to src/functions-templates/javascript/node-fetch/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'node-fetch',
33
description: 'Fetch function: uses node-fetch to hit an external API without CORS issues',
44
functionType: 'serverless',

src/functions-templates/javascript/oauth-passport/.netlify-function-template.cjs renamed to src/functions-templates/javascript/oauth-passport/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'oauth-passport',
33
description: 'oauth-passport: template for Oauth workflow using Passport + Express.js',
44
functionType: 'serverless',

src/functions-templates/javascript/protected-function/.netlify-function-template.cjs renamed to src/functions-templates/javascript/protected-function/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'protected-function',
33
description: 'Function protected Netlify Identity authentication',
44
functionType: 'serverless',

src/functions-templates/javascript/sanity-create/.netlify-function-template.cjs renamed to src/functions-templates/javascript/sanity-create/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'sanity-create',
33
description: 'Create documents in Sanity.io',
44
functionType: 'serverless',

src/functions-templates/javascript/sanity-groq/.netlify-function-template.cjs renamed to src/functions-templates/javascript/sanity-groq/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'sanity-groq',
33
description: 'Query a Sanity.io dataset with GROQ',
44
functionType: 'serverless',

src/functions-templates/javascript/scheduled-function/.netlify-function-template.cjs renamed to src/functions-templates/javascript/scheduled-function/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'scheduled-function',
33
priority: 1,
44
description: 'Basic implementation of a scheduled function in JavaScript.',

src/functions-templates/javascript/send-email/.netlify-function-template.cjs renamed to src/functions-templates/javascript/send-email/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'send-email',
33
description: "Send Email: Send email with no SMTP server via 'sendmail' pkg",
44
functionType: 'serverless',

src/functions-templates/javascript/serverless-ssr/.netlify-function-template.cjs renamed to src/functions-templates/javascript/serverless-ssr/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'serverless-ssr',
33
description: 'Dynamic serverside rendering via functions',
44
functionType: 'serverless',

src/functions-templates/javascript/set-cookie/.netlify-function-template.cjs renamed to src/functions-templates/javascript/set-cookie/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'set-cookie',
33
description: 'Set a cookie alongside your function',
44
functionType: 'serverless',

src/functions-templates/javascript/set-cookies/.netlify-function-template.cjs renamed to src/functions-templates/javascript/set-cookies/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'set-cookies',
33
description: 'Create and manage HTTP cookies',
44
functionType: 'edge',

src/functions-templates/typescript/set-req-header/.netlify-function-template.cjs renamed to src/functions-templates/javascript/set-req-header/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'set-req-header',
33
description: 'Adds a custom HTTP header to HTTP request.',
44
functionType: 'edge',

src/functions-templates/javascript/set-res-header/.netlify-function-template.cjs renamed to src/functions-templates/javascript/set-res-header/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'set-res-header',
33
description: 'Adds a custom HTTP header to HTTP response.',
44
functionType: 'edge',

src/functions-templates/javascript/slack-rate-limit/.netlify-function-template.cjs renamed to src/functions-templates/javascript/slack-rate-limit/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'slack-rate-limit',
33
description: 'Slack Rate-limit: post to Slack, at most once an hour, using Netlify Identity metadata',
44
functionType: 'serverless',

src/functions-templates/javascript/stripe-charge/.netlify-function-template.cjs renamed to src/functions-templates/javascript/stripe-charge/.netlify-function-template.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const chalk = require('chalk')
1+
import chalk from 'chalk'
22

3-
module.exports = {
3+
export default {
44
name: 'stripe-charge',
55
description: 'Stripe Charge: Charge a user with Stripe',
66
functionType: 'serverless',

src/functions-templates/javascript/stripe-subscription/.netlify-function-template.cjs renamed to src/functions-templates/javascript/stripe-subscription/.netlify-function-template.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const chalk = require('chalk')
1+
import chalk from 'chalk'
22

3-
module.exports = {
3+
export default {
44
name: 'stripe-subscription',
55
description: 'Stripe subscription: Create a subscription with Stripe',
66
functionType: 'serverless',

src/functions-templates/javascript/submission-created/.netlify-function-template.cjs renamed to src/functions-templates/javascript/submission-created/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'submission-created',
33
description: 'submission-created: template for event triggered function when a new Netlify Form is submitted',
44
functionType: 'serverless',

src/functions-templates/javascript/token-hider/.netlify-function-template.cjs renamed to src/functions-templates/javascript/token-hider/.netlify-function-template.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const chalk = require('chalk')
1+
import chalk from 'chalk'
22

3-
module.exports = {
3+
export default {
44
name: 'token-hider',
55
description: 'Token Hider: access APIs without exposing your API keys',
66
functionType: 'serverless',

src/functions-templates/typescript/transform-response/.netlify-function-template.cjs renamed to src/functions-templates/javascript/transform-response/.netlify-function-template.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
name: 'transform-response',
33
description: 'Transform the content of an HTTP response',
44
functionType: 'edge',

0 commit comments

Comments
 (0)