Skip to content
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"prettier-plugin-svelte": "^3.4.1",
"sv": "workspace:*",
"svelte": "^5.53.0",
"tsdown": "^0.18.4",
"tsdown": "^0.21.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.54.0",
"vitest": "4.1.0-beta.4"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { array, object, variables, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { array, object, variables } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const array1 = array.create();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { array, variables, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { array, variables } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const array1 = array.create();
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/arrays/empty-array/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { array, variables, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { array, variables } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const emptyArray = array.create();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { array, object, variables, type AstTypes } from '../../../../tooling/js/index.ts';
import { type AstTypes } from '../../../../tooling/index.ts';
import { array, object, variables } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const array1 = array.create();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { array, variables, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { array, variables } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const array1 = array.create();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { common, kit, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { common, kit } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const platform = kit.addGlobalAppInterface(ast as AstTypes.TSProgram, { name: 'Platform' });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { common, exports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { common, exports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
exports.createDefault(ast, {
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/common/jsdoc-comment/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { common, type Comments, type AstTypes } from '../../../../tooling/js/index.ts';
import type { Comments, AstTypes } from '../../../../tooling/index.ts';
import { common } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program, comments: Comments): void {
const functionDeclaration = ast.body[0] as AstTypes.FunctionDeclaration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { common, variables, type Comments, type AstTypes } from '../../../../tooling/js/index.ts';
import type { Comments, AstTypes } from '../../../../tooling/index.ts';
import { common, variables } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program, comments: Comments): void {
const declaration = variables.declaration(ast, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { object, variables, exports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { object, variables, exports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const object1 = object.create({
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/exports/default-export/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { object, exports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { object, exports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const object1 = object.create({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { common, variables, object, exports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { common, variables, object, exports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const variableFallback = variables.declaration(ast, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { variables, object, exports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { variables, object, exports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const fallback = variables.declaration(ast, {
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/exports/named-export/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { variables, object, exports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { variables, object, exports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const object1 = object.create({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { exports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { exports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
// With 'as' option
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { functions, common, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { functions, common } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const insideExpression = common.parseExpression("console.log('foo')");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { functions, common, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { functions, common } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const functionCall = functions.createCall({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { functions, common, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { functions, common } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const functionCall = functions.createCall({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
imports.addEmpty(ast, { from: 'package/file.js' });
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/imports/default-import/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
imports.addDefault(ast, { from: 'package', as: 'MyPackage' });
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/imports/empty-import/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
imports.addEmpty(ast, { from: './relativ/file.css' });
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/imports/find-import/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
imports.addNamed(ast, { from: 'package', imports: { namedOne: 'namedOneAlias' }, isType: false });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
imports.addNamed(ast, { from: 'package', imports: ['namedOne'], isType: false });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
imports.addNamed(ast, { from: 'package', imports: { namedTwo: 'namedTwo' }, isType: false });
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/imports/named-import/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
imports.addNamed(ast, { from: 'package', imports: { namedOne: 'namedOne' }, isType: false });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
imports.addNamespace(ast, { from: 'package', as: 'foo' });
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/imports/remove-import/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
imports.remove(ast, { name: 'n2', from: 'p1' });
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/imports/reverse-order/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
// imports should be added HERE in the reverse order
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { kit, type AstTypes, type Comments } from '../../../../tooling/js/index.ts';
import type { AstTypes, Comments } from '../../../../tooling/index.ts';
import { kit } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program, comments: Comments): void {
kit.addHooksHandle(ast, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { kit, type AstTypes, type Comments } from '../../../../tooling/js/index.ts';
import type { AstTypes, Comments } from '../../../../tooling/index.ts';
import { kit } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program, comments: Comments): void {
kit.addHooksHandle(ast, {
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/object/create/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { variables, object, common, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { variables, object, common } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const emptyObject = object.create({});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { object, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { object } from '../../../../tooling/js/index.ts';
import { getTestObjectExpression } from '../objectTestHelper.ts';

export function run(ast: AstTypes.Program): void {
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/object/objectTestHelper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { variables, object, type AstTypes } from '../../../tooling/js/index.ts';
import type { AstTypes } from '../../../tooling/index.ts';
import { variables, object } from '../../../tooling/js/index.ts';

export const getTestObjectExpression = (ast: AstTypes.Program): AstTypes.ObjectExpression => {
const variable = variables.declaration(ast, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { object, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { object } from '../../../../tooling/js/index.ts';
import { getTestObjectExpression } from '../objectTestHelper.ts';

export function run(ast: AstTypes.Program): void {
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/object/property-node/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { object, common, type AstTypes, type Comments } from '../../../../tooling/js/index.ts';
import type { AstTypes, Comments } from '../../../../tooling/index.ts';
import { object, common } from '../../../../tooling/js/index.ts';
import { getTestObjectExpression } from '../objectTestHelper.ts';

export function run(ast: AstTypes.Program, comments: Comments): void {
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/object/property/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { object, common, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { object, common } from '../../../../tooling/js/index.ts';
import { getTestObjectExpression } from '../objectTestHelper.ts';

export function run(ast: AstTypes.Program): void {
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/variables/declaration/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { variables, common, object, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { variables, common, object } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const testNumberVariable = variables.declaration(ast, {
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/variables/identifier/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { variables, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { variables } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const barVariable = variables.declaration(ast, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { variables, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { variables } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const decl = ast.body[0] as any;
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/vite/add-plugin-mode/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, vite, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports, vite } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const pMiddle = 'middlePlugin';
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/vite/default/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, vite, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports, vite } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const vitePluginName = 'myPlugin';
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/vite/function-return/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, vite, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports, vite } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const vitePluginName = 'myPlugin';
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/vite/with-alias/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, vite, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports, vite } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const vitePluginName = 'myPlugin';
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/vite/with-satisfies/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, vite, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports, vite } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const vitePluginName = 'myPlugin';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { array, common, vite, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { array, common, vite } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
// This mimics the vitest addon pattern: getConfig + configProperty + array.append
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, vite, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports, vite } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const vitePluginName = 'myPlugin';
Expand Down
3 changes: 2 additions & 1 deletion packages/sv-utils/src/tests/js/vite/with-variable/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, vite, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports, vite } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const vitePluginName = 'myPlugin';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imports, vite, type AstTypes } from '../../../../tooling/js/index.ts';
import type { AstTypes } from '../../../../tooling/index.ts';
import { imports, vite } from '../../../../tooling/js/index.ts';

export function run(ast: AstTypes.Program): void {
const vitePluginName = 'myPlugin';
Expand Down
3 changes: 1 addition & 2 deletions packages/sv-utils/src/tooling/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { print as esrapPrint } from 'esrap';
import ts from 'esrap/languages/ts';
import type { BaseNode } from 'estree';
import * as fleece from 'silver-fleece';
import * as toml from 'smol-toml';
import {
Expand All @@ -11,7 +10,7 @@ import {
} from 'svelte/compiler';
import * as yaml from 'yaml';
import * as Walker from 'zimmerframe';
import type { TsEstree } from './js/ts-estree.ts';
import type { BaseNode, TsEstree } from './js/ts-estree.ts';
import { ensureScript } from './svelte/index.ts';

export type {
Expand Down
1 change: 0 additions & 1 deletion packages/sv-utils/src/tooling/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ export * as variables from './variables.ts';
export * as exports from './exports.ts';
export * as kit from './kit.ts';
export * as vite from './vite.ts';
export type { AstTypes, Comments } from '../index.ts';
1 change: 1 addition & 0 deletions packages/sv-utils/src/tooling/js/ts-estree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@ declare module 'estree' {
}

export type { estree as TsEstree };
export type { BaseNode } from 'estree';
12 changes: 2 additions & 10 deletions packages/sv-utils/src/tooling/js/vite.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import {
type AstTypes,
array,
common,
exports,
functions,
imports,
object,
variables
} from './index.ts';
import type { AstTypes } from '../index.ts';
import { array, common, exports, functions, imports, object, variables } from './index.ts';

function isConfigWrapper(
callExpression: AstTypes.CallExpression,
Expand Down
3 changes: 2 additions & 1 deletion packages/sv/src/addons/better-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ export default defineAddon({
const isProp = (name: string, node: AstTypes.Property) =>
node.key.type === 'Identifier' && node.key.name === name;

// tsgo can't infer visitor node types from zimmerframe's distributive conditional
Walker.walk(ast as AstTypes.Node, null, {
Property(node) {
Property(node: AstTypes.Property) {
if (
isProp('dialect', node) &&
node.value.type === 'Literal' &&
Expand Down
Loading
Loading