Skip to content

Commit

Permalink
Merge pull request #17 from lxsmnsyc/next
Browse files Browse the repository at this point in the history
0.15
  • Loading branch information
lxsmnsyc authored Oct 11, 2023
2 parents 2a6a127 + eca4e6b commit d5b7556
Show file tree
Hide file tree
Showing 42 changed files with 3,909 additions and 2,700 deletions.
13 changes: 7 additions & 6 deletions examples/comments/package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"name": "vite-example-comments",
"type": "module",
"version": "0.14.7",
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"devDependencies": {
"eslint": "^8.34.0",
"eslint-config-lxsmnsyc": "^0.5.1",
"typescript": "^4.9.5",
"vite": "^4.2.0",
"vite-plugin-solid": "^2.6.1",
"eslint": "^8.51.0",
"eslint-config-lxsmnsyc": "^0.6.5",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vite-plugin-solid": "^2.7.0",
"vite-plugin-solid-labels": "0.14.7"
},
"private": true,
"publishConfig": {
"access": "restricted"
},
"dependencies": {
"solid-js": "^1.6.15"
"solid-js": "^1.8.0"
}
}
14 changes: 7 additions & 7 deletions examples/ctf/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "vite-example-ctf",
"type": "module",
"version": "0.14.7",
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"devDependencies": {
"babel-plugin-solid-labels": "0.14.7",
"eslint": "^8.34.0",
"eslint-config-lxsmnsyc": "^0.5.1",
"typescript": "^4.9.5",
"vite": "^4.2.0",
"vite-plugin-solid": "^2.6.1",
"eslint": "^8.51.0",
"eslint-config-lxsmnsyc": "^0.6.5",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vite-plugin-solid": "^2.7.0",
"vite-plugin-solid-labels": "0.14.7"
},
"private": true,
"publishConfig": {
"access": "restricted"
},
"dependencies": {
"solid-js": "^1.6.15"
"solid-js": "^1.8.0"
}
}
13 changes: 7 additions & 6 deletions examples/labels/package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"name": "vite-example-labels",
"type": "module",
"version": "0.14.7",
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"devDependencies": {
"eslint": "^8.34.0",
"eslint-config-lxsmnsyc": "^0.5.1",
"typescript": "^4.9.5",
"vite": "^4.2.0",
"vite-plugin-solid": "^2.6.1",
"eslint": "^8.51.0",
"eslint-config-lxsmnsyc": "^0.6.5",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vite-plugin-solid": "^2.7.0",
"vite-plugin-solid-labels": "0.14.7"
},
"private": true,
"publishConfig": {
"access": "restricted"
},
"dependencies": {
"solid-js": "^1.6.15"
"solid-js": "^1.8.0"
}
}
1 change: 0 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"useWorkspaces": true,
"packages": [
"packages/*",
"examples/*"
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"examples/*"
],
"devDependencies": {
"eslint": "^8.34.0",
"eslint-config-lxsmnsyc": "^0.5.1",
"lerna": "^6.5.1",
"typescript": "^4.9.5"
"eslint": "^8.51.0",
"eslint-config-lxsmnsyc": "^0.6.5",
"lerna": "^7.3.0",
"typescript": "^5.2.2"
}
}
30 changes: 15 additions & 15 deletions packages/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@
],
"name": "babel-plugin-solid-labels",
"devDependencies": {
"@babel/core": "^7.21.3",
"@types/babel__core": "^7.20.0",
"@types/babel__traverse": "^7.18.3",
"@types/node": "^18.15.3",
"eslint": "^8.34.0",
"eslint-config-lxsmnsyc": "^0.5.1",
"pridepack": "^2.4.2",
"solid-js": "^1.6.15",
"tslib": "^2.5.0",
"typescript": "^4.9.5",
"vitest": "^0.29.3"
"@babel/core": "^7.23.0",
"@types/babel__core": "^7.20.2",
"@types/babel__traverse": "^7.20.2",
"@types/node": "^20.8.2",
"eslint": "^8.51.0",
"eslint-config-lxsmnsyc": "^0.6.5",
"pridepack": "2.5.0",
"solid-js": "^1.8.0",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
},
"peerDependencies": {
"@babel/core": "^7.20",
"@babel/core": "^7.23",
"solid-js": "^1.3"
},
"scripts": {
Expand All @@ -58,9 +58,9 @@
"test": "vitest"
},
"dependencies": {
"@babel/helper-module-imports": "^7.18.6",
"@babel/traverse": "^7.20.13",
"@babel/types": "^7.20.7"
"@babel/helper-module-imports": "^7.22.15",
"@babel/traverse": "^7.23.0",
"@babel/types": "^7.23.0"
},
"description": "Simple, reactive labels for SolidJS",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/babel/src/components.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as t from '@babel/types';
import { State } from './core/types';
import type { State } from './core/types';
import getImportIdentifier from './core/get-import-identifier';

type ComponentImport = [name: string, source: string];
Expand Down Expand Up @@ -40,7 +40,7 @@ const NAMESPACE_COMPONENTS: Record<string, ComponentImport> = {
'no-hydration': ['NoHydration', 'solid-js/web'],
};

export default function transformComponents(state: State, path: babel.NodePath) {
export default function transformComponents(state: State, path: babel.NodePath): void {
path.traverse({
Expression(p) {
if (
Expand Down
4 changes: 2 additions & 2 deletions packages/babel/src/core/accessor-variable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as babel from '@babel/core';
import type * as babel from '@babel/core';
import * as t from '@babel/types';
import derefMemo from './deref-memo';

Expand All @@ -7,7 +7,7 @@ export default function accessorVariable(
accessorIdentifier: t.Identifier,
callee: t.Identifier,
replacement: Array<t.Expression | t.SpreadElement | t.JSXNamespacedName | t.ArgumentPlaceholder>,
) {
): t.VariableDeclarator {
const readIdentifier = path.scope.generateUidIdentifier(accessorIdentifier.name);

derefMemo(
Expand Down
25 changes: 0 additions & 25 deletions packages/babel/src/core/arrays.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/babel/src/core/deferred-variable.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import * as babel from '@babel/core';
import type * as babel from '@babel/core';
import * as t from '@babel/types';
import accessorVariable from './accessor-variable';
import getImportIdentifier from './get-import-identifier';
import { State } from './types';
import type { State } from './types';

export default function deferredVariable(
state: State,
path: babel.NodePath,
deferredIdentifier: t.Identifier,
stateIdentifier: t.Expression = t.identifier('undefined'),
optionsIdentifier: t.Expression | undefined = undefined,
) {
): t.VariableDeclarator {
const normalIdentifier = t.arrowFunctionExpression([], stateIdentifier);
const args: t.Expression[] = [normalIdentifier];
if (state.opts.dev) {
Expand Down
4 changes: 2 additions & 2 deletions packages/babel/src/core/deref-memo-variable.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as babel from '@babel/core';
import type * as babel from '@babel/core';
import * as t from '@babel/types';
import derefMemo from './deref-memo';

export default function derefMemoVariable(
path: babel.NodePath,
memoIdentifier: t.Identifier,
stateIdentifier: t.Expression,
) {
): t.VariableDeclarator {
const readIdentifier = path.scope.generateUidIdentifier(memoIdentifier.name);

derefMemo(
Expand Down
3 changes: 1 addition & 2 deletions packages/babel/src/core/deref-memo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as babel from '@babel/core';
import type * as babel from '@babel/core';
import * as t from '@babel/types';
import assert from './assert';
import { unexpectedType } from './errors';
// import isInTypeScript from './is-in-typescript';
import unwrapNode from './unwrap-node';

const REF_MEMO_CTF = '$refMemo';
Expand Down
4 changes: 2 additions & 2 deletions packages/babel/src/core/deref-signal-variable.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as babel from '@babel/core';
import type * as babel from '@babel/core';
import * as t from '@babel/types';
import derefSignal from './deref-signal';

export default function derefSignalVariable(
path: babel.NodePath,
signalIdentifier: t.Identifier,
stateIdentifier: t.Expression,
) {
): t.VariableDeclarator {
const readIdentifier = path.scope.generateUidIdentifier(signalIdentifier.name);
const writeIdentifier = path.scope.generateUidIdentifier(`set${signalIdentifier.name}`);
derefSignal(
Expand Down
2 changes: 1 addition & 1 deletion packages/babel/src/core/deref-signal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as babel from '@babel/core';
import type * as babel from '@babel/core';
import * as t from '@babel/types';
import assert from './assert';
import { unexpectedType } from './errors';
Expand Down
17 changes: 9 additions & 8 deletions packages/babel/src/core/destructure-variable.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as babel from '@babel/core';
import type * as babel from '@babel/core';
import * as t from '@babel/types';
import { forEach } from './arrays';
import derefMemo from './deref-memo';
import { unexpectedType } from './errors';
import getImportIdentifier from './get-import-identifier';
import isStatic from './is-static';
import { State } from './types';
import type { State } from './types';
import unwrapNode from './unwrap-node';

export default function destructureVariable(
Expand All @@ -14,15 +13,16 @@ export default function destructureVariable(
target: t.Expression,
pattern: t.ObjectPattern | t.ArrayPattern,
defaultValue?: t.Expression,
) {
): t.VariableDeclarator[] {
const otherIdentifier = path.scope.generateUidIdentifier('other');
let declarators: t.VariableDeclarator[] = [];
const properties: t.Expression[] = [];
let restIdentifier: t.Identifier | undefined;

// Destructuring for object patterns
if (t.isObjectPattern(pattern)) {
forEach(pattern.properties, (property) => {
for (let i = 0, len = pattern.properties.length; i < len; i++) {
const property = pattern.properties[i];
// Check if this is an object property
if (t.isObjectProperty(property)) {
const { value, key } = property;
Expand Down Expand Up @@ -148,10 +148,11 @@ export default function destructureVariable(
restIdentifier = trueIdentifier;
}
}
});
}
} else {
// Destructure for arrays
forEach(pattern.elements, (property, i) => {
for (let i = 0, len = pattern.elements.length; i < len; i++) {
const property = pattern.elements[i];
if (property) {
const keyExpr = t.numericLiteral(i);

Expand Down Expand Up @@ -257,7 +258,7 @@ export default function destructureVariable(
}
}
}
});
}
}

const expr = t.variableDeclarator(
Expand Down
2 changes: 1 addition & 1 deletion packages/babel/src/core/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as babel from '@babel/core';
import type * as babel from '@babel/core';

export function unexpectedType<T>(
path: babel.NodePath<T>,
Expand Down
6 changes: 3 additions & 3 deletions packages/babel/src/core/get-import-identifier.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as t from '@babel/types';
import * as babel from '@babel/core';
import type * as t from '@babel/types';
import type * as babel from '@babel/core';
import { addNamed } from '@babel/helper-module-imports';
import { State } from './types';
import type { State } from './types';

export default function getImportIdentifier(
state: State,
Expand Down
Loading

0 comments on commit d5b7556

Please sign in to comment.