@tokenami/node 0.0.96--canary.bootstrap.0 → 0.0.96--canary.494.27281440883.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1841,8 +1841,10 @@ ${colorDescription}`);
1841
1841
  const node = findNodeAtPosition(sourceFile, position);
1842
1842
  if (!node || !node.parent || !ts.isPropertyAssignment(node.parent)) return original;
1843
1843
  const property = node.parent;
1844
+ const objLit = ts.findAncestor(property, ts.isObjectLiteralExpression);
1845
+ if (!objLit || !this.#isTokenamiObject(objLit, fileName)) return original;
1844
1846
  const propertyName = property.name.getText(sourceFile);
1845
- const propertyValue = property.initializer.getText();
1847
+ const propertyValue = getExpressionText(property.initializer, sourceFile);
1846
1848
  const tokenProperty3 = Tokenami2.TokenProperty.safeParse(propertyName);
1847
1849
  const tokenValue2 = Tokenami2.TokenValue.safeParse(propertyValue);
1848
1850
  if (!tokenProperty3.success || !tokenValue2.success) return original;
@@ -1968,6 +1970,10 @@ function findNodeAtPosition(sourceFile, position) {
1968
1970
  function createTextSpanFromNode(node) {
1969
1971
  return { start: node.getStart(), length: node.getEnd() - node.getStart() };
1970
1972
  }
1973
+ function getExpressionText(node, sourceFile) {
1974
+ if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) return node.text;
1975
+ return node.getText(sourceFile);
1976
+ }
1971
1977
  var createEntryDetails = (original, entryConfig, documentation) => ({
1972
1978
  ...original,
1973
1979
  ...entryConfig,
@@ -1108,8 +1108,10 @@ ${colorDescription}`);
1108
1108
  const node = findNodeAtPosition(sourceFile, position);
1109
1109
  if (!node || !node.parent || !ts__default.default.isPropertyAssignment(node.parent)) return original;
1110
1110
  const property = node.parent;
1111
+ const objLit = ts__default.default.findAncestor(property, ts__default.default.isObjectLiteralExpression);
1112
+ if (!objLit || !this.#isTokenamiObject(objLit, fileName)) return original;
1111
1113
  const propertyName = property.name.getText(sourceFile);
1112
- const propertyValue = property.initializer.getText();
1114
+ const propertyValue = getExpressionText(property.initializer, sourceFile);
1113
1115
  const tokenProperty2 = TokenamiConfig3__namespace.TokenProperty.safeParse(propertyName);
1114
1116
  const tokenValue2 = TokenamiConfig3__namespace.TokenValue.safeParse(propertyValue);
1115
1117
  if (!tokenProperty2.success || !tokenValue2.success) return original;
@@ -1235,6 +1237,10 @@ function findNodeAtPosition(sourceFile, position) {
1235
1237
  function createTextSpanFromNode(node) {
1236
1238
  return { start: node.getStart(), length: node.getEnd() - node.getStart() };
1237
1239
  }
1240
+ function getExpressionText(node, sourceFile) {
1241
+ if (ts__default.default.isStringLiteral(node) || ts__default.default.isNoSubstitutionTemplateLiteral(node)) return node.text;
1242
+ return node.getText(sourceFile);
1243
+ }
1238
1244
  var createEntryDetails = (original, entryConfig, documentation) => ({
1239
1245
  ...original,
1240
1246
  ...entryConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenami/node",
3
- "version": "0.0.96--canary.bootstrap.0",
3
+ "version": "0.0.96--canary.494.27281440883.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,8 +29,16 @@
29
29
  "dist",
30
30
  "stubs"
31
31
  ],
32
+ "scripts": {
33
+ "build": "tsup",
34
+ "dev": "tsup --watch",
35
+ "test": "vitest --run",
36
+ "test:watch": "vitest",
37
+ "typecheck": "tsc --noEmit"
38
+ },
32
39
  "dependencies": {
33
40
  "@stitches/stringify": "^1.2.8",
41
+ "@tokenami/config": "0.0.96--canary.494.27281440883.0",
34
42
  "acorn": "^8.11.3",
35
43
  "acorn-walk": "^8.3.2",
36
44
  "css-tree": "^3.0.0",
@@ -40,8 +48,7 @@
40
48
  "jiti": "^1.21.0",
41
49
  "lightningcss": "1.29.1",
42
50
  "pathe": "^1.1.1",
43
- "sucrase": "^3.34.0",
44
- "@tokenami/config": "0.0.95"
51
+ "sucrase": "^3.34.0"
45
52
  },
46
53
  "devDependencies": {
47
54
  "@types/css-tree": "^2.3.8",
@@ -54,11 +61,5 @@
54
61
  "peerDependencies": {
55
62
  "typescript": ">= 5"
56
63
  },
57
- "scripts": {
58
- "build": "tsup",
59
- "dev": "tsup --watch",
60
- "test": "vitest --run",
61
- "test:watch": "vitest",
62
- "typecheck": "tsc --noEmit"
63
- }
64
- }
64
+ "gitHead": "8e2117cb1f4188f2f28be1ff97bb390abbe3b4c6"
65
+ }