Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ npmPreapprovedPackages:

# Protect the runtime of calls to "yarn run" scripts using a local plugin.
plugins:
- path: ./lavamoat/plugin-allow-scripts.js
- path: ./lavamoat/.runner-plugin.js
- path: ./lavamoat/plugin-allow-scripts.cjs
- path: ./lavamoat/.runner-plugin.cjs
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const config = createConfig([
// Handled by Oxfmt.
'prettier/prettier': 'off',
'import-x/order': 'off',

// Does not make sense with ESM.
'import-x/no-useless-path-segments': 'off',
},
},

Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions lavamoat/scripts.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"notes": "Should prevent basic malicious behavior of writing to locations outside the project and sending network requests, but not break any of the advanced packages in use. Everything below the net permission can be used to bypass the restrictions by a more sophisticated attacker.",
"nodeOptions": {
"--disable-warning": "SecurityWarning",
"--permission": true,
"--allow-fs-read": ["/"],
"--allow-fs-write": ["./"],
"--allow-net": false,
"--allow-child-process": true,
"--allow-worker": false,
"--allow-addons": false,
"--allow-wasi": false,
"--allow-inspector": false
}
}
30 changes: 8 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,12 @@
"files": [
"dist"
],
"type": "module",
"sideEffects": false,
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.cts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
Expand All @@ -35,7 +27,7 @@
"registry": "https://registry.npmjs.org/"
},
"scripts": {
"build": "ts-bridge --project tsconfig.build.json --clean",
"build": "tsc --project tsconfig.build.json",
"build:docs": "typedoc",
"lint": "yarn lint:eslint && yarn lint:constraints && yarn lint:misc --check && yarn lint:dependencies --check && yarn lint:changelog",
"lint:changelog": "auto-changelog validate --formatter oxfmt",
Expand All @@ -48,21 +40,17 @@
"lint:fix": "yarn lint:eslint --fix && yarn lint:constraints --fix && yarn lint:misc --write && yarn lint:dependencies:fix && yarn lint:changelog --fix",
"lint:misc": "oxfmt --ignore-path .gitignore",
"prepack": "./scripts/prepack.sh",
"test": "yarn test:vitest && yarn test:package",
"test:vitest": "vitest",
"test:watch": "yarn test:vitest --watch",
"test:package": "yarn pack --out .yarn/package.tgz && attw .yarn/package.tgz"
"test": "vitest",
"test:watch": "vitest --watch"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.3",
"@lavamoat/allow-scripts": "^5.1.0",
"@lavamoat/preinstall-always-fail": "^2.0.0",
"@metamask/auto-changelog": "^6.2.1",
"@metamask/eslint-config": "^15.0.0",
"@metamask/eslint-config-nodejs": "^15.0.0",
"@metamask/eslint-config-typescript": "^15.0.0",
"@metamask/eslint-config-vitest": "^15.0.0",
"@ts-bridge/cli": "^0.6.3",
"@types/node": "^18.18",
"@typescript-eslint/utils": "^8.6.0",
"@vitest/coverage-istanbul": "^4.1.4",
Expand All @@ -78,7 +66,6 @@
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.1.0",
"oxfmt": "^0.45.0",
"ts-node": "^10.7.0",
"typedoc": "^0.26.11",
"typescript": "~5.7.3",
"typescript-eslint": "^8.48.1",
Expand Down Expand Up @@ -107,6 +94,7 @@
},
"scriptsConfig": {
"#default": "lavamoat/scripts.strict.json",
"build": "lavamoat/scripts.build.json",
"lint": "lavamoat/scripts.yarn.json",
"lint:changelog": "lavamoat/scripts.lint.json",
"lint:constraints": "lavamoat/scripts.yarn.json",
Expand All @@ -117,9 +105,7 @@
"lint:fix": "lavamoat/scripts.yarn.json",
"lint:misc": "lavamoat/scripts.lint.json",
"prepack": "lavamoat/scripts.yarn.json",
"test": "lavamoat/scripts.yarn.json",
"test:vitest": "lavamoat/scripts.test.json",
"test:package": "lavamoat/scripts.test.json",
"test": "lavamoat/scripts.test.json",
"test:watch": "lavamoat/scripts.test.json"
}
}
2 changes: 1 addition & 1 deletion src/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expectTypeOf } from 'vitest';

import greeter from '.';
import greeter from './index.js';

describe('greeter', () => {
it('returns a string', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';

import greeter from '.';
import greeter from './index.js';

describe('greeter', () => {
it('greets', () => {
Expand Down
1 change: 0 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"inlineSources": true,
"noEmit": false,
"outDir": "dist",
Expand Down
16 changes: 4 additions & 12 deletions yarn.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,10 @@ module.exports = defineConfig({
// The package must specify Yarn as the package manager, with a sha256 hash.
expectYarnPackageManager(workspace);

// The package must provide the location of the CommonJS-compatible
// entrypoint and its matching type declaration file.
workspace.set('main', './dist/index.cjs');
workspace.set('exports["."].require.default', './dist/index.cjs');
workspace.set('types', './dist/index.d.cts');
workspace.set('exports["."].require.types', './dist/index.d.cts');

// The package must provide the location of the ESM-compatible JavaScript
// entrypoint and its matching type declaration file.
workspace.set('module', './dist/index.mjs');
workspace.set('exports["."].import.default', './dist/index.mjs');
workspace.set('exports["."].import.types', './dist/index.d.mts');
// The package must provide the location of the CommonJS- and ESM-compatible
// JavaScript entrypoint and its matching type declaration file.
workspace.set('exports["."].default', './dist/index.js');
workspace.set('exports["."].types', './dist/index.d.ts');

// The package must export a `package.json` file.
workspace.set('exports["./package.json"]', './package.json');
Expand Down
Loading
Loading