Skip to content

Commit

Permalink
Bump & QoL (#626)
Browse files Browse the repository at this point in the history
* Update dependency eslint-plugin-unused-imports to v3.1.0

* Update dependency eslint to v8.57.0

* Update dependency prettier-plugin-svelte to v3.2.2

* Update dependency typescript to v5.4.2

* Update dependency @sveltejs/package to v2.3.0

* tmp test strip

* color tweak maangement

* ♻️ UPDATE: renames

* playwright

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
jycouet and renovate[bot] committed Mar 11, 2024
1 parent 8d93f1d commit 25e8e33
Show file tree
Hide file tree
Showing 19 changed files with 699 additions and 215 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-comics-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'vite-plugin-stripper': minor
---

change arg `packages` to `nullify`
2 changes: 1 addition & 1 deletion packages/create-kitql/templates/kit-routes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"test:ci": "npm run test:e2e && npm run test"
},
"devDependencies": {
"@playwright/test": "^1.41.2",
"@playwright/test": "^1.42.1",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"devDependencies": {
"@kitql/eslint-config": "^0.3.1",
"@playwright/test": "^1.41.2",
"@playwright/test": "^1.42.1",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@
"@typescript-eslint/parser": "6.21.0",
"@vue/compiler-sfc": "3.4.7",
"commander": "^12.0.0",
"eslint": "8.56.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-svelte": "2.35.0",
"eslint-plugin-unused-imports": "3.0.0",
"eslint-plugin-unused-imports": "3.1.0",
"prettier": "3.2.4",
"prettier-plugin-sh": "0.14.0",
"prettier-plugin-svelte": "3.1.0",
"prettier-plugin-svelte": "3.2.2",
"prettier-plugin-tailwindcss": "0.5.7",
"svelte": "4.2.0",
"typescript": "5.3.2"
"typescript": "5.4.2"
},
"sideEffects": false,
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/handles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
"@kitql/helpers": "workspace:*",
"@sveltejs/adapter-node": "^2.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/package": "2.2.2",
"@sveltejs/package": "2.3.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"publint": "0.2.4",
"svelte": "4.2.1",
"svelte-check": "3.6.0",
"tslib": "2.6.2",
"typescript": "5.3.2",
"typescript": "5.4.2",
"vite": "^5.0.0",
"vitest": "^1.0.0"
},
Expand Down
7 changes: 5 additions & 2 deletions packages/helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,21 @@
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/package": "2.2.2",
"@sveltejs/package": "2.3.0",
"@kitql/eslint-config": "workspace:*",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"publint": "0.2.4",
"rollup-plugin-visualizer": "^5.9.2",
"svelte": "4.2.1",
"svelte-check": "3.6.0",
"tslib": "2.6.2",
"typescript": "5.3.2",
"typescript": "5.4.2",
"vite": "^5.0.0",
"vitest": "^1.0.0"
},
"dependencies": {
"esm-env": "^1.0.0"
},
"sideEffects": false,
"publishConfig": {
"directory": "dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/helpers/src/lib/Log.browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { Log } from './Log.js'

describe('kitql - helper - Log', () => {
beforeEach(() => {
vi.mock('$lib/constants.js', () => ({
vi.mock('esm-env', () => ({
BROWSER: true,
}))
})
Expand Down
2 changes: 1 addition & 1 deletion packages/helpers/src/lib/colors/colors.browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { color, colorProcess, red } from './index.js'

describe('browser', () => {
beforeEach(() => {
vi.mock('$lib/constants.js', () => ({
vi.mock('esm-env', () => ({
BROWSER: true,
}))
})
Expand Down
2 changes: 1 addition & 1 deletion packages/helpers/src/lib/colors/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BROWSER } from '../constants.js'
import { BROWSER } from 'esm-env'
import * as stylesBrowser from './stylesBrowser.js'
import * as stylesNode from './stylesNode.js'
import type { Style } from './types.js'
Expand Down
3 changes: 0 additions & 3 deletions packages/helpers/src/lib/constants.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/internals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/package": "2.2.2",
"@sveltejs/package": "2.3.0",
"@kitql/eslint-config": "workspace:*",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"publint": "0.2.4",
"rollup-plugin-visualizer": "^5.9.2",
"svelte-check": "3.6.0",
"tslib": "2.6.2",
"typescript": "5.3.2",
"typescript": "5.4.2",
"vite": "^5.0.0",
"vitest": "^1.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/vite-plugin-kit-routes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
"@kitql/eslint-config": "workspace:*",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/package": "2.2.2",
"@sveltejs/package": "2.3.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"publint": "0.2.4",
"svelte": "4.2.1",
"svelte-check": "3.6.0",
"tslib": "2.6.2",
"typescript": "5.3.2",
"typescript": "5.4.2",
"vite": "^5.0.0",
"vitest": "^1.0.0"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/vite-plugin-stripper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
"@kitql/eslint-config": "workspace:*",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/package": "2.2.2",
"@sveltejs/package": "2.3.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"oslo": "^1.1.2",
"publint": "0.2.4",
"remult": "^0.25.0",
"svelte": "4.2.1",
"svelte-check": "3.6.0",
"tslib": "2.6.2",
"typescript": "5.3.2",
"typescript": "5.4.2",
"vite": "^5.0.0",
"vitest": "^1.0.0"
},
Expand Down
16 changes: 12 additions & 4 deletions packages/vite-plugin-stripper/src/lib/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ export type ViteStriperOptions = {
hard?: boolean

/**
* for example: `['mongodb']`
* For example if you set `nullify: ['mongodb']`
*
* ```ts
* // This line
* import { ObjectId } from 'mongodb'
*
* // We become
* let ObjectId = null;
* ```
*/
packages?: string[]
nullify?: string[]

/**
* If true, skip warnings if a throw is not a class.
Expand Down Expand Up @@ -135,8 +143,8 @@ export function stripper(options?: ViteStriperOptions): Plugin[] {
}
}

if (options && options?.packages && options.packages.length > 0) {
const { info, ...rest } = await removePackages(code, options.packages)
if (options && options?.nullify && options.nullify.length > 0) {
const { info, ...rest } = await removePackages(code, options.nullify)

// Update the code for later transforms & return it
code = rest.code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const transformDecorator = async (
// Empty functions with one of the decorators. (ex @BackendMethod decorator)
visit(ast.program, {
visitClassDeclaration(path) {
// @ts-ignore
currentClassName = path.node.id.name
this.traverse(path)
},
Expand Down
5 changes: 5 additions & 0 deletions packages/vite-plugin-stripper/src/shared/actionsController.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Bcrypt } from 'oslo/password'

import { BackendMethod, remult, type Allowed } from 'remult'

import { AUTH_SECRET } from '$env/static/private'
Expand All @@ -8,6 +10,9 @@ export class ActionsController {
allowed: () => remult.user === undefined,
})
static async read(info: Allowed) {
const b = new Bcrypt()
b.hash('1234')

console.info('AUTH_SECRET', AUTH_SECRET)
return AUTH_SECRET + ' ' + info
}
Expand Down
5 changes: 3 additions & 2 deletions packages/vite-plugin-stripper/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { stripper } from './src/lib/plugin.js'
export default defineConfig({
plugins: [
stripper({
decorators: ['BackendMethod'],
debug: false,
// decorators: ['BackendMethod'],
debug: true,
log_on_throw_is_not_a_new_class: true,
hard: true,
nullify: ['$env/static/private', 'oslo/password'],
}),
//
sveltekit(),
Expand Down
4 changes: 2 additions & 2 deletions packages/vite-plugin-watch-and-run/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@sveltejs/package": "2.2.2",
"@sveltejs/package": "2.3.0",
"publint": "0.2.4",
"svelte": "4.2.1",
"svelte-check": "3.6.0",
"tslib": "2.6.2",
"typescript": "5.3.2",
"typescript": "5.4.2",
"vite": "^5.0.0",
"vitest": "^1.0.0"
},
Expand Down

0 comments on commit 25e8e33

Please sign in to comment.