Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
fix(register): Remove source-map-support (#86)
Browse files Browse the repository at this point in the history
Node.js 14.18+ now supports this natively.

BREAKING CHANGE: `skuba-dive/register` no longer configures
`source-map-support` for your project. Upgrade to Node.js 14.18+ and use
the built-in `--enable-source-maps` option.

For a containerised application, update your Dockerfile:

```diff
- FROM gcr.io/distroless/nodejs:14 AS runtime
+ FROM gcr.io/distroless/nodejs:16 AS runtime

+ # https://nodejs.org/api/cli.html#cli_node_options_options
+ ENV NODE_OPTIONS --enable-source-maps
```

For a Serverless Lambda application, update your `serverless.yml`:

```diff
provider:
- runtime: nodejs12.x
+ runtime: nodejs14.x

functions:
  Worker:
    environment:
+     # https://nodejs.org/api/cli.html#cli_node_options_options
+     NODE_OPTIONS: --enable-source-maps
```

For a CDK Lambda application, update your stack:

```diff
new aws_lambda.Function(this, 'worker', {
- runtime: aws_lambda.Runtime.NODEJS_12_X,
+ runtime: aws_lambda.Runtime.NODEJS_14_X,
  environment: {
+   // https://nodejs.org/api/cli.html#cli_node_options_options
+   NODE_OPTIONS: '--enable-source-maps',
  },
});
```

See seek-oss/skuba#761 for more examples.
  • Loading branch information
72636c authored Feb 9, 2022
1 parent 6fbac46 commit c47f63a
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 86 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,20 @@ Each function will throw if its environment variable is not set and `opts.defaul

### Register

Runtime hook for:
Runtime hook for import paths relative to `/src`.

- Import paths relative to `/src`
- Stack traces that map back to your `.ts` sources

Make a side-effectful import at the top of your entry point, e.g. `/src/app.ts`:
Make a side-effectful import at the top of your entry point(s):

```typescript
// /src/register.ts

import 'skuba-dive/register';
```

```typescript
// /src/app.ts

import './register';

import { config } from 'src/config';

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
"url": "https://github.com/seek-oss/skuba-dive/issues"
},
"dependencies": {
"module-alias": "^2.2.2",
"source-map-support": "^0.5.16"
"module-alias": "^2.2.2"
},
"description": "Minimal runtime for skuba",
"devDependencies": {
"@types/module-alias": "2.0.1",
"skuba": "3.17.2"
},
"engines": {
"node": ">=14.18"
},
"files": [
"lib/**/*.d.ts",
"lib/**/*.js",
Expand Down
8 changes: 0 additions & 8 deletions register.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
// istanbul ignore if
/**
* @see {@link https://github.com/kulshekhar/ts-jest/issues/727#issuecomment-422743605}
*/
if (typeof jest === 'undefined') {
require('source-map-support/register');
}

/**
* @see {@link https://nodejs.org/api/deprecations.html#DEP0144}
*/
Expand Down
142 changes: 71 additions & 71 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4912,76 +4912,76 @@ npm@^7.0.0:
resolved "https://registry.yarnpkg.com/npm/-/npm-7.24.2.tgz#861117af8241bea592289f22407230e5300e59ca"
integrity sha512-120p116CE8VMMZ+hk8IAb1inCPk4Dj3VZw29/n2g6UI77urJKVYb7FZUDW8hY+EBnfsjI/2yrobBgFyzo7YpVQ==
dependencies:
"@isaacs/string-locale-compare" "*"
"@npmcli/arborist" "*"
"@npmcli/ci-detect" "*"
"@npmcli/config" "*"
"@npmcli/map-workspaces" "*"
"@npmcli/package-json" "*"
"@npmcli/run-script" "*"
abbrev "*"
ansicolors "*"
ansistyles "*"
archy "*"
cacache "*"
chalk "*"
chownr "*"
cli-columns "*"
cli-table3 "*"
columnify "*"
fastest-levenshtein "*"
glob "*"
graceful-fs "*"
hosted-git-info "*"
ini "*"
init-package-json "*"
is-cidr "*"
json-parse-even-better-errors "*"
libnpmaccess "*"
libnpmdiff "*"
libnpmexec "*"
libnpmfund "*"
libnpmhook "*"
libnpmorg "*"
libnpmpack "*"
libnpmpublish "*"
libnpmsearch "*"
libnpmteam "*"
libnpmversion "*"
make-fetch-happen "*"
minipass "*"
minipass-pipeline "*"
mkdirp "*"
mkdirp-infer-owner "*"
ms "*"
node-gyp "*"
nopt "*"
npm-audit-report "*"
npm-install-checks "*"
npm-package-arg "*"
npm-pick-manifest "*"
npm-profile "*"
npm-registry-fetch "*"
npm-user-validate "*"
npmlog "*"
opener "*"
pacote "*"
parse-conflict-json "*"
qrcode-terminal "*"
read "*"
read-package-json "*"
read-package-json-fast "*"
readdir-scoped-modules "*"
rimraf "*"
semver "*"
ssri "*"
tar "*"
text-table "*"
tiny-relative-date "*"
treeverse "*"
validate-npm-package-name "*"
which "*"
write-file-atomic "*"
"@isaacs/string-locale-compare" "^1.1.0"
"@npmcli/arborist" "^2.9.0"
"@npmcli/ci-detect" "^1.2.0"
"@npmcli/config" "^2.3.0"
"@npmcli/map-workspaces" "^1.0.4"
"@npmcli/package-json" "^1.0.1"
"@npmcli/run-script" "^1.8.6"
abbrev "~1.1.1"
ansicolors "~0.3.2"
ansistyles "~0.1.3"
archy "~1.0.0"
cacache "^15.3.0"
chalk "^4.1.2"
chownr "^2.0.0"
cli-columns "^3.1.2"
cli-table3 "^0.6.0"
columnify "~1.5.4"
fastest-levenshtein "^1.0.12"
glob "^7.2.0"
graceful-fs "^4.2.8"
hosted-git-info "^4.0.2"
ini "^2.0.0"
init-package-json "^2.0.5"
is-cidr "^4.0.2"
json-parse-even-better-errors "^2.3.1"
libnpmaccess "^4.0.2"
libnpmdiff "^2.0.4"
libnpmexec "^2.0.1"
libnpmfund "^1.1.0"
libnpmhook "^6.0.2"
libnpmorg "^2.0.2"
libnpmpack "^2.0.1"
libnpmpublish "^4.0.1"
libnpmsearch "^3.1.1"
libnpmteam "^2.0.3"
libnpmversion "^1.2.1"
make-fetch-happen "^9.1.0"
minipass "^3.1.3"
minipass-pipeline "^1.2.4"
mkdirp "^1.0.4"
mkdirp-infer-owner "^2.0.0"
ms "^2.1.2"
node-gyp "^7.1.2"
nopt "^5.0.0"
npm-audit-report "^2.1.5"
npm-install-checks "^4.0.0"
npm-package-arg "^8.1.5"
npm-pick-manifest "^6.1.1"
npm-profile "^5.0.3"
npm-registry-fetch "^11.0.0"
npm-user-validate "^1.0.1"
npmlog "^5.0.1"
opener "^1.5.2"
pacote "^11.3.5"
parse-conflict-json "^1.1.1"
qrcode-terminal "^0.12.0"
read "~1.0.7"
read-package-json "^4.1.1"
read-package-json-fast "^2.0.3"
readdir-scoped-modules "^1.1.0"
rimraf "^3.0.2"
semver "^7.3.5"
ssri "^8.0.1"
tar "^6.1.11"
text-table "~0.2.0"
tiny-relative-date "^1.3.0"
treeverse "^1.0.4"
validate-npm-package-name "~3.0.0"
which "^2.0.2"
write-file-atomic "^3.0.3"

npmlog@*, npmlog@^6.0.0:
version "6.0.0"
Expand Down Expand Up @@ -5978,7 +5978,7 @@ socks@^2.6.1:
ip "^1.1.5"
smart-buffer "^4.1.0"

source-map-support@^0.5.12, source-map-support@^0.5.16, source-map-support@^0.5.17, source-map-support@^0.5.6:
source-map-support@^0.5.12, source-map-support@^0.5.17, source-map-support@^0.5.6:
version "0.5.21"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
Expand Down

0 comments on commit c47f63a

Please sign in to comment.