@open-dy/vibecoding-sdk-taro 0.0.1-beta.6 → 0.0.1-beta.7

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.
@@ -70,7 +70,7 @@ function createLucideColorCheckPlugin(importSources = ['@open-dy/lucide-taro'])
70
70
  const cssImportGuardPlugin = {
71
71
  processors: {
72
72
  css: {
73
- preprocess(text) {
73
+ preprocess(text, filename) {
74
74
  const lines = text.replace(/\/\*[\s\S]*?\*\//g, comment => {
75
75
  if (comment.includes('eslint-')) return comment;
76
76
  return comment.replace(/[^\n]/g, ' ');
@@ -102,6 +102,18 @@ const cssImportGuardPlugin = {
102
102
  ].join(' ');
103
103
  });
104
104
 
105
+ // Scope this guard to the SDK-based host app; OpenCard has its own CSS pipeline.
106
+ if (filename.replaceAll('\\', '/').endsWith('/src/app.css')) {
107
+ const css = lines.join('\n');
108
+ const imports = [...css.matchAll(/@import\s+(?:url\(\s*)?['"]([^'"]+)['"]/g)]
109
+ .map(match => match[1]);
110
+ const usesSdkTheme = imports.some(value => /^@[^/]+\/vibecoding-sdk-taro\/ui\/tailwind\.css$/.test(value));
111
+ const hasUtilities = imports.some(value => ['weapp-tailwindcss', 'tailwindcss', 'tailwindcss/utilities.css', 'weapp-tailwindcss/utilities.css'].includes(value))
112
+ || /@tailwind\s+utilities\s*;/.test(css);
113
+ if (usesSdkTheme && !hasUtilities) {
114
+ virtualLines[0] = `${virtualLines[0] ?? ''} __cssMissingTailwindEntry();`;
115
+ }
116
+ }
105
117
  return [virtualLines.join('\n')];
106
118
  },
107
119
  postprocess(messages) {
@@ -250,6 +262,16 @@ function collectStaticStrings(node, result = []) {
250
262
 
251
263
  const tailwindEnforcementPlugin = {
252
264
  rules: {
265
+ 'require-utilities-entry': {
266
+ create(context) {
267
+ return {
268
+ CallExpression(node) {
269
+ if (node.callee?.name !== '__cssMissingTailwindEntry') return;
270
+ context.report({ node, message: 'src/app.css 缺少 Tailwind 工具类入口。请保留模板的 @import "weapp-tailwindcss";;SDK ui/tailwind.css 只提供主题和组件扫描,不能替代此入口。' });
271
+ },
272
+ };
273
+ },
274
+ },
253
275
  'no-arbitrary-font-size': {
254
276
  create(context) {
255
277
  function reportArbitraryFontSize(node, className) {
@@ -519,6 +541,7 @@ export function createMicroappTaroEslintConfig(options = {}) {
519
541
  },
520
542
  processor: 'local/css',
521
543
  rules: {
544
+ 'tailwind/require-utilities-entry': 'error',
522
545
  'no-undef': 'off',
523
546
  'tailwind/no-arbitrary-font-size': 'error',
524
547
  'no-restricted-syntax': ['error', ...baseRestrictedSyntaxRules],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-dy/vibecoding-sdk-taro",
3
- "version": "0.0.1-beta.6",
3
+ "version": "0.0.1-beta.7",
4
4
  "description": "Runtime, UI, build and ESLint capabilities for Douyin Taro templates.",
5
5
  "type": "module",
6
6
  "files": [
@@ -2,14 +2,14 @@
2
2
  "schema": 1,
3
3
  "producer": "vibecoding-sdk-taro",
4
4
  "packageName": "@open-dy/vibecoding-sdk-taro",
5
- "version": "0.0.1-beta.6",
5
+ "version": "0.0.1-beta.7",
6
6
  "source": {
7
- "digest": "sha256-1df526c157223fdc703483001cab9ac5b3dc45a5b8182fa2fd4b4d0145f748f1",
7
+ "digest": "sha256-70d888bef69823f77d1d5a58b0e20bf193915c5ce25185336d30cfcdacaf6a19",
8
8
  "files": 135
9
9
  },
10
- "payload": "sha256-81190e53ee14521fee32cd83315a9109b52ec404c7c6a787e84f28f4ffb44f68",
10
+ "payload": "sha256-06890dab056fc5f4fb35cfb4916a61bafdda30348ca897a84e1664a0e1d964eb",
11
11
  "toolchain": {
12
- "node": "v22.23.3",
12
+ "node": "v22.22.3",
13
13
  "packageManager": null
14
14
  }
15
15
  }
@@ -70,7 +70,7 @@ function createLucideColorCheckPlugin(importSources = ['@open-dy/lucide-taro'])
70
70
  const cssImportGuardPlugin = {
71
71
  processors: {
72
72
  css: {
73
- preprocess(text) {
73
+ preprocess(text, filename) {
74
74
  const lines = text.replace(/\/\*[\s\S]*?\*\//g, comment => {
75
75
  if (comment.includes('eslint-')) return comment;
76
76
  return comment.replace(/[^\n]/g, ' ');
@@ -102,6 +102,18 @@ const cssImportGuardPlugin = {
102
102
  ].join(' ');
103
103
  });
104
104
 
105
+ // Scope this guard to the SDK-based host app; OpenCard has its own CSS pipeline.
106
+ if (filename.replaceAll('\\', '/').endsWith('/src/app.css')) {
107
+ const css = lines.join('\n');
108
+ const imports = [...css.matchAll(/@import\s+(?:url\(\s*)?['"]([^'"]+)['"]/g)]
109
+ .map(match => match[1]);
110
+ const usesSdkTheme = imports.some(value => /^@[^/]+\/vibecoding-sdk-taro\/ui\/tailwind\.css$/.test(value));
111
+ const hasUtilities = imports.some(value => ['weapp-tailwindcss', 'tailwindcss', 'tailwindcss/utilities.css', 'weapp-tailwindcss/utilities.css'].includes(value))
112
+ || /@tailwind\s+utilities\s*;/.test(css);
113
+ if (usesSdkTheme && !hasUtilities) {
114
+ virtualLines[0] = `${virtualLines[0] ?? ''} __cssMissingTailwindEntry();`;
115
+ }
116
+ }
105
117
  return [virtualLines.join('\n')];
106
118
  },
107
119
  postprocess(messages) {
@@ -250,6 +262,16 @@ function collectStaticStrings(node, result = []) {
250
262
 
251
263
  const tailwindEnforcementPlugin = {
252
264
  rules: {
265
+ 'require-utilities-entry': {
266
+ create(context) {
267
+ return {
268
+ CallExpression(node) {
269
+ if (node.callee?.name !== '__cssMissingTailwindEntry') return;
270
+ context.report({ node, message: 'src/app.css 缺少 Tailwind 工具类入口。请保留模板的 @import "weapp-tailwindcss";;SDK ui/tailwind.css 只提供主题和组件扫描,不能替代此入口。' });
271
+ },
272
+ };
273
+ },
274
+ },
253
275
  'no-arbitrary-font-size': {
254
276
  create(context) {
255
277
  function reportArbitraryFontSize(node, className) {
@@ -519,6 +541,7 @@ export function createMicroappTaroEslintConfig(options = {}) {
519
541
  },
520
542
  processor: 'local/css',
521
543
  rules: {
544
+ 'tailwind/require-utilities-entry': 'error',
522
545
  'no-undef': 'off',
523
546
  'tailwind/no-arbitrary-font-size': 'error',
524
547
  'no-restricted-syntax': ['error', ...baseRestrictedSyntaxRules],