Skip to content

Commit

Permalink
fix: remove @babel/plugin-proposal-object-rest-spread (#31)
Browse files Browse the repository at this point in the history
* fix: remove `@babel/plugin-proposal-object-rest-spread`

* feat: support custom babel plugins (`@alpha`)

* test: update playground

Co-authored-by: Marius Lundgård <studio@mariuslundgard.com>
  • Loading branch information
stipsan and mariuslundgard committed Jan 4, 2023
1 parent 4966ef5 commit 44b8aad
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 40 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -56,7 +56,6 @@
},
"dependencies": {
"@babel/core": "^7.20.7",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/preset-env": "^7.20.2",
"@babel/types": "^7.20.7",
"@microsoft/api-extractor": "^7.33.7",
Expand Down
7 changes: 7 additions & 0 deletions playground/babel-plugin/package.config.ts
@@ -0,0 +1,7 @@
import {defineConfig} from '@sanity/pkg-utils'

export default defineConfig({
babel: {
plugins: ['@babel/plugin-proposal-object-rest-spread'],
},
})
29 changes: 29 additions & 0 deletions playground/babel-plugin/package.json
@@ -0,0 +1,29 @@
{
"private": true,
"type": "module",
"name": "babel-plugin",
"version": "0.0.0-development",
"license": "MIT",
"types": "./dist/index.d.ts",
"source": "./src/index.ts",
"module": "./dist/index.js",
"main": "./dist/index.cjs",
"exports": {
".": {
"types": "./dist/index.d.ts",
"source": "./src/index.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"build": "run-s clean && pkg build --strict --tsconfig tsconfig.dist.json && pkg --strict --tsconfig tsconfig.dist.json",
"clean": "rimraf dist"
},
"devDependencies": {
"@babel/core": "^7.20.7",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7"
}
}
6 changes: 6 additions & 0 deletions playground/babel-plugin/src/index.ts
@@ -0,0 +1,6 @@
/** @public */
export function defineThing(options: {name: string; age: number}) {
const {name, ...restOptions} = options

return {name, rest: restOptions}
}
9 changes: 9 additions & 0 deletions playground/babel-plugin/tsconfig.dist.json
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.settings",
"include": ["./src"],
"compilerOptions": {
"rootDir": ".",
"outDir": "./dist",
"emitDeclarationOnly": true
}
}
8 changes: 8 additions & 0 deletions playground/babel-plugin/tsconfig.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.settings",
"include": ["./package.config.ts", "./src"],
"compilerOptions": {
"rootDir": ".",
"noEmit": true
}
}
29 changes: 29 additions & 0 deletions playground/babel-plugin/tsconfig.settings.json
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "ES2020",
"declaration": true,
"declarationMap": true,
"sourceMap": true,

// Strict type-checking
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,

// Additional checks
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,

// Module resolution
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
}
}

0 comments on commit 44b8aad

Please sign in to comment.