@powerlines/plugin-tamagui 0.1.491 → 0.1.492

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.cjs CHANGED
@@ -3,6 +3,7 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  let _stryke_fs_resolve = require("@stryke/fs/resolve");
4
4
  let _stryke_hash_neutral = require("@stryke/hash/neutral");
5
5
  let _stryke_path_join = require("@stryke/path/join");
6
+ let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
6
7
  let _tamagui_static_worker = require("@tamagui/static-worker");
7
8
  _tamagui_static_worker = require_runtime.__toESM(_tamagui_static_worker, 1);
8
9
  let defu = require("defu");
@@ -37,8 +38,8 @@ const plugin = (options = {}) => {
37
38
  config: configPath,
38
39
  disableExtraction: false,
39
40
  platform: "web",
40
- logTimings: this.config.logLevel === "debug" || this.config.logLevel === "trace",
41
- prefixLogs: "Powerlines"
41
+ logTimings: this.config.logLevel.performance === "debug" || this.config.logLevel.performance === "trace",
42
+ prefixLogs: (0, _stryke_string_format_title_case.titleCase)(this.config.framework?.name) || "Powerlines"
42
43
  }));
43
44
  const alias = [];
44
45
  if (tamaguiOptions.platform !== "native") {
@@ -104,7 +105,7 @@ const plugin = (options = {}) => {
104
105
  _frameTimestamp: void 0,
105
106
  _WORKLET: false,
106
107
  __DEV__: `${this.config.mode === "development"}`,
107
- "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || this.config.mode),
108
+ "process.env.NODE_ENV": JSON.stringify(this.config.mode),
108
109
  "process.env.ENABLE_RSC": JSON.stringify(process.env.ENABLE_RSC || ""),
109
110
  "process.env.ENABLE_STEPS": JSON.stringify(process.env.ENABLE_STEPS || ""),
110
111
  "process.env.IS_STATIC": JSON.stringify(false),
@@ -131,8 +132,8 @@ const plugin = (options = {}) => {
131
132
  }
132
133
  },
133
134
  async resolveId(id) {
134
- if (this.environment?.name && (this.environment.name === "ios" || this.environment.name === "android")) return;
135
- if (this.config?.tamagui?.disableServerOptimization && this.environment?.name && this.environment.name !== "client") return;
135
+ if (this.config.environment?.name && (this.config.environment.name === "ios" || this.config.environment.name === "android")) return;
136
+ if (this.config?.tamagui?.disableServerOptimization && this.config.environment?.name && this.config.environment.name !== "client") return;
136
137
  const [validId, query] = id.split("?");
137
138
  if (!validId?.endsWith(".tamagui.css")) return;
138
139
  let absoluteId = id;
@@ -142,8 +143,8 @@ const plugin = (options = {}) => {
142
143
  },
143
144
  async load(id) {
144
145
  if (this.config?.tamagui?.disableExtraction) return;
145
- if (this.environment?.name && (this.environment.name === "ios" || this.environment.name === "android")) return;
146
- if (this.config?.tamagui?.disableServerOptimization && this.environment?.name && this.environment.name !== "client") return;
146
+ if (this.config.environment?.name && (this.config.environment.name === "ios" || this.config.environment.name === "android")) return;
147
+ if (this.config?.tamagui?.disableServerOptimization && this.config.environment?.name && this.config.environment.name !== "client") return;
147
148
  const [validId] = id.split("?");
148
149
  return validId ? cssMap.get(validId) : null;
149
150
  },
@@ -155,8 +156,8 @@ const plugin = (options = {}) => {
155
156
  jsx: "automatic"
156
157
  });
157
158
  if (this.config?.tamagui?.disableExtraction) return;
158
- if (this.environment?.name && (this.environment.name === "ios" || this.environment.name === "android")) return;
159
- if (this.config?.tamagui?.disableServerOptimization && this.environment?.name && this.environment.name !== "client") return;
159
+ if (this.config.environment?.name && (this.config.environment.name === "ios" || this.config.environment.name === "android")) return;
160
+ if (this.config?.tamagui?.disableServerOptimization && this.config.environment?.name && this.config.environment.name !== "client") return;
160
161
  const [validId] = id.split("?");
161
162
  if (!validId?.endsWith(".tsx")) return;
162
163
  const firstCommentIndex = code.indexOf("// ");
@@ -164,15 +165,14 @@ const plugin = (options = {}) => {
164
165
  source: firstCommentIndex >= 0 ? code.slice(firstCommentIndex) : "",
165
166
  path: validId
166
167
  });
167
- if (shouldPrintDebug) this.trace(`Current file: ${id} in environment: ${this.environment?.name}, shouldDisable: ${shouldDisable}\n\nOriginal source:\n${code}\n\n`);
168
+ if (shouldPrintDebug) this.trace(`Current file: ${id} in environment: ${this.config.environment?.name}, shouldDisable: ${shouldDisable}\n\nOriginal source:\n${code}\n\n`);
168
169
  if (shouldDisable) return;
169
170
  const cacheKey = (0, _stryke_hash_neutral.murmurhash)({
170
- cacheEnv: this.environment.name === "client" || this.environment.name === "ssr" ? "web" : this.environment.name,
171
+ cacheEnv: this.config.environment.name === "client" || this.config.environment.name === "ssr" ? "web" : this.config.environment.name,
171
172
  code,
172
173
  id
173
174
  });
174
- const cached = memoryCache[cacheKey];
175
- if (cached) return cached;
175
+ if (memoryCache[cacheKey]) return memoryCache[cacheKey];
176
176
  let extracted;
177
177
  try {
178
178
  extracted = await _tamagui_static_worker.extractToClassNames({
@@ -186,23 +186,22 @@ const plugin = (options = {}) => {
186
186
  return;
187
187
  }
188
188
  if (!extracted) return;
189
- const rootRelativeId = `${validId}.tamagui.css`;
190
- let absoluteId = rootRelativeId;
191
- if (!absoluteId.startsWith(this.config.root)) absoluteId = (0, _stryke_path_join.joinPaths)(this.config.root, rootRelativeId);
189
+ let absoluteId = `${validId}.tamagui.css`;
190
+ if (!absoluteId.startsWith(this.config.root)) absoluteId = (0, _stryke_path_join.joinPaths)(this.config.root, `${validId}.tamagui.css`);
192
191
  let source = extracted.js;
193
192
  if (extracted.styles) {
194
- this.addWatchFile(rootRelativeId);
193
+ this.addWatchFile(`${validId}.tamagui.css`);
195
194
  if (server && cssMap.has(absoluteId)) {
196
195
  if (server) {
197
196
  const { moduleGraph } = server;
198
- const modules = moduleGraph.getModulesByFile(rootRelativeId);
197
+ const modules = moduleGraph.getModulesByFile(`${validId}.tamagui.css`);
199
198
  if (modules) for (const module of modules) {
200
199
  moduleGraph.invalidateModule(module);
201
200
  module.lastHMRTimestamp = module.lastInvalidationTimestamp || Date.now();
202
201
  }
203
202
  }
204
203
  }
205
- source = `${source.toString()}\nimport "${rootRelativeId}";`;
204
+ source = `${source.toString()}\nimport "${validId}.tamagui.css";`;
206
205
  cssMap.set(absoluteId, extracted.styles);
207
206
  }
208
207
  const result = {
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { resolvePackage } from "@stryke/fs/resolve";
2
2
  import { murmurhash } from "@stryke/hash/neutral";
3
3
  import { joinPaths } from "@stryke/path/join";
4
+ import { titleCase } from "@stryke/string-format/title-case";
4
5
  import * as Static from "@tamagui/static-worker";
5
6
  import { getPragmaOptions, loadTamaguiBuildConfig } from "@tamagui/static-worker";
6
7
  import defu from "defu";
@@ -34,8 +35,8 @@ const plugin = (options = {}) => {
34
35
  config: configPath,
35
36
  disableExtraction: false,
36
37
  platform: "web",
37
- logTimings: this.config.logLevel === "debug" || this.config.logLevel === "trace",
38
- prefixLogs: "Powerlines"
38
+ logTimings: this.config.logLevel.performance === "debug" || this.config.logLevel.performance === "trace",
39
+ prefixLogs: titleCase(this.config.framework?.name) || "Powerlines"
39
40
  }));
40
41
  const alias = [];
41
42
  if (tamaguiOptions.platform !== "native") {
@@ -101,7 +102,7 @@ const plugin = (options = {}) => {
101
102
  _frameTimestamp: void 0,
102
103
  _WORKLET: false,
103
104
  __DEV__: `${this.config.mode === "development"}`,
104
- "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || this.config.mode),
105
+ "process.env.NODE_ENV": JSON.stringify(this.config.mode),
105
106
  "process.env.ENABLE_RSC": JSON.stringify(process.env.ENABLE_RSC || ""),
106
107
  "process.env.ENABLE_STEPS": JSON.stringify(process.env.ENABLE_STEPS || ""),
107
108
  "process.env.IS_STATIC": JSON.stringify(false),
@@ -128,8 +129,8 @@ const plugin = (options = {}) => {
128
129
  }
129
130
  },
130
131
  async resolveId(id) {
131
- if (this.environment?.name && (this.environment.name === "ios" || this.environment.name === "android")) return;
132
- if (this.config?.tamagui?.disableServerOptimization && this.environment?.name && this.environment.name !== "client") return;
132
+ if (this.config.environment?.name && (this.config.environment.name === "ios" || this.config.environment.name === "android")) return;
133
+ if (this.config?.tamagui?.disableServerOptimization && this.config.environment?.name && this.config.environment.name !== "client") return;
133
134
  const [validId, query] = id.split("?");
134
135
  if (!validId?.endsWith(".tamagui.css")) return;
135
136
  let absoluteId = id;
@@ -139,8 +140,8 @@ const plugin = (options = {}) => {
139
140
  },
140
141
  async load(id) {
141
142
  if (this.config?.tamagui?.disableExtraction) return;
142
- if (this.environment?.name && (this.environment.name === "ios" || this.environment.name === "android")) return;
143
- if (this.config?.tamagui?.disableServerOptimization && this.environment?.name && this.environment.name !== "client") return;
143
+ if (this.config.environment?.name && (this.config.environment.name === "ios" || this.config.environment.name === "android")) return;
144
+ if (this.config?.tamagui?.disableServerOptimization && this.config.environment?.name && this.config.environment.name !== "client") return;
144
145
  const [validId] = id.split("?");
145
146
  return validId ? cssMap.get(validId) : null;
146
147
  },
@@ -152,8 +153,8 @@ const plugin = (options = {}) => {
152
153
  jsx: "automatic"
153
154
  });
154
155
  if (this.config?.tamagui?.disableExtraction) return;
155
- if (this.environment?.name && (this.environment.name === "ios" || this.environment.name === "android")) return;
156
- if (this.config?.tamagui?.disableServerOptimization && this.environment?.name && this.environment.name !== "client") return;
156
+ if (this.config.environment?.name && (this.config.environment.name === "ios" || this.config.environment.name === "android")) return;
157
+ if (this.config?.tamagui?.disableServerOptimization && this.config.environment?.name && this.config.environment.name !== "client") return;
157
158
  const [validId] = id.split("?");
158
159
  if (!validId?.endsWith(".tsx")) return;
159
160
  const firstCommentIndex = code.indexOf("// ");
@@ -161,15 +162,14 @@ const plugin = (options = {}) => {
161
162
  source: firstCommentIndex >= 0 ? code.slice(firstCommentIndex) : "",
162
163
  path: validId
163
164
  });
164
- if (shouldPrintDebug) this.trace(`Current file: ${id} in environment: ${this.environment?.name}, shouldDisable: ${shouldDisable}\n\nOriginal source:\n${code}\n\n`);
165
+ if (shouldPrintDebug) this.trace(`Current file: ${id} in environment: ${this.config.environment?.name}, shouldDisable: ${shouldDisable}\n\nOriginal source:\n${code}\n\n`);
165
166
  if (shouldDisable) return;
166
167
  const cacheKey = murmurhash({
167
- cacheEnv: this.environment.name === "client" || this.environment.name === "ssr" ? "web" : this.environment.name,
168
+ cacheEnv: this.config.environment.name === "client" || this.config.environment.name === "ssr" ? "web" : this.config.environment.name,
168
169
  code,
169
170
  id
170
171
  });
171
- const cached = memoryCache[cacheKey];
172
- if (cached) return cached;
172
+ if (memoryCache[cacheKey]) return memoryCache[cacheKey];
173
173
  let extracted;
174
174
  try {
175
175
  extracted = await Static.extractToClassNames({
@@ -183,23 +183,22 @@ const plugin = (options = {}) => {
183
183
  return;
184
184
  }
185
185
  if (!extracted) return;
186
- const rootRelativeId = `${validId}.tamagui.css`;
187
- let absoluteId = rootRelativeId;
188
- if (!absoluteId.startsWith(this.config.root)) absoluteId = joinPaths(this.config.root, rootRelativeId);
186
+ let absoluteId = `${validId}.tamagui.css`;
187
+ if (!absoluteId.startsWith(this.config.root)) absoluteId = joinPaths(this.config.root, `${validId}.tamagui.css`);
189
188
  let source = extracted.js;
190
189
  if (extracted.styles) {
191
- this.addWatchFile(rootRelativeId);
190
+ this.addWatchFile(`${validId}.tamagui.css`);
192
191
  if (server && cssMap.has(absoluteId)) {
193
192
  if (server) {
194
193
  const { moduleGraph } = server;
195
- const modules = moduleGraph.getModulesByFile(rootRelativeId);
194
+ const modules = moduleGraph.getModulesByFile(`${validId}.tamagui.css`);
196
195
  if (modules) for (const module of modules) {
197
196
  moduleGraph.invalidateModule(module);
198
197
  module.lastHMRTimestamp = module.lastInvalidationTimestamp || Date.now();
199
198
  }
200
199
  }
201
200
  }
202
- source = `${source.toString()}\nimport "${rootRelativeId}";`;
201
+ source = `${source.toString()}\nimport "${validId}.tamagui.css";`;
203
202
  cssMap.set(absoluteId, extracted.styles);
204
203
  }
205
204
  const result = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-tamagui",
3
- "version": "0.1.491",
3
+ "version": "0.1.492",
4
4
  "private": false,
5
5
  "description": "A package containing the Tamagui plugin for Powerlines.",
6
6
  "keywords": ["tamagui", "powerlines", "storm-software", "powerlines-plugin"],
@@ -57,21 +57,22 @@
57
57
  "typings": "dist/index.d.mts",
58
58
  "files": ["dist/**/*"],
59
59
  "dependencies": {
60
- "@powerlines/plugin-vite": "^0.14.494",
60
+ "@powerlines/plugin-vite": "^0.14.495",
61
+ "@stryke/string-format": "^0.17.18",
61
62
  "@stryke/fs": "^0.33.76",
62
63
  "@stryke/hash": "^0.13.29",
63
64
  "@stryke/path": "^0.29.3",
64
65
  "@tamagui/static-worker": "^1.144.4",
65
66
  "@tamagui/types": "^1.144.4",
66
67
  "defu": "^6.1.7",
67
- "powerlines": "^0.47.40",
68
+ "powerlines": "^0.47.41",
68
69
  "typescript": "^6.0.3",
69
70
  "vite": "^8.0.13"
70
71
  },
71
72
  "devDependencies": {
72
- "@powerlines/plugin-plugin": "^0.12.452",
73
+ "@powerlines/plugin-plugin": "^0.12.453",
73
74
  "@types/node": "^25.8.0"
74
75
  },
75
76
  "publishConfig": { "access": "public" },
76
- "gitHead": "c5c293e753d59ab690265988c77bd535680ac71b"
77
+ "gitHead": "b5c7361d0ca942652f98baf11488435c7918fd65"
77
78
  }