@modern-js/tailwindcss-generator 3.3.9 → 3.3.11

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -51055,7 +51055,6 @@ __export(src_exports, {
51055
51055
  handleTemplateFile: () => handleTemplateFile
51056
51056
  });
51057
51057
  module.exports = __toCommonJS(src_exports);
51058
- var import_path6 = __toESM(require("path"));
51059
51058
 
51060
51059
  // ../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/esm/_define_property.js
51061
51060
  function _define_property(obj, key, value) {
@@ -51066,12 +51065,12 @@ function _define_property(obj, key, value) {
51066
51065
  return obj;
51067
51066
  }
51068
51067
 
51069
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
51068
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
51070
51069
  var import_utils13 = require("@modern-js/utils");
51071
51070
  var import_lodash5 = require("@modern-js/utils/lodash");
51072
51071
  var import_comment_json = __toESM(require_src2());
51073
51072
 
51074
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.4/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/env.js
51073
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.5/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/env.js
51075
51074
  var import_utils = require("@modern-js/utils");
51076
51075
  async function canUseNvm() {
51077
51076
  try {
@@ -51121,7 +51120,7 @@ async function canUsePnpm() {
51121
51120
  }
51122
51121
  }
51123
51122
 
51124
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.4/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/install.js
51123
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.5/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/install.js
51125
51124
  var import_utils2 = require("@modern-js/utils");
51126
51125
  function execaWithStreamLog(command, args, options) {
51127
51126
  const promise = (0, import_utils2.execa)(command, args, {
@@ -51217,7 +51216,7 @@ async function pnpmInstall({ cwd, registryUrl, ignoreScripts, useNvm }) {
51217
51216
  throw new Error("please install pnpm first");
51218
51217
  }
51219
51218
 
51220
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.4/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/index.js
51219
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.5/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/index.js
51221
51220
  var NpmAPI = class {
51222
51221
  npmInstall({ cwd, registryUrl, ignoreScripts }) {
51223
51222
  return npmInstall({
@@ -51246,7 +51245,7 @@ var NpmAPI = class {
51246
51245
  }
51247
51246
  };
51248
51247
 
51249
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.3.4_@modern-js+codesmith@2.3.4/node_modules/@modern-js/codesmith-api-git/dist/esm-node/utils/index.js
51248
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.3.5_@modern-js+codesmith@2.3.5/node_modules/@modern-js/codesmith-api-git/dist/esm-node/utils/index.js
51250
51249
  var import_utils4 = require("@modern-js/utils");
51251
51250
  async function canUseGit() {
51252
51251
  try {
@@ -51321,7 +51320,7 @@ async function gitCommit(cwd, commitMessage) {
51321
51320
  });
51322
51321
  }
51323
51322
 
51324
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.3.4_@modern-js+codesmith@2.3.4/node_modules/@modern-js/codesmith-api-git/dist/esm-node/index.js
51323
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.3.5_@modern-js+codesmith@2.3.5/node_modules/@modern-js/codesmith-api-git/dist/esm-node/index.js
51325
51324
  var GitAPI = class {
51326
51325
  async isInGitRepo(cwd = this.generatorCore.outputPath) {
51327
51326
  const canUse = await canUseGit();
@@ -51373,12 +51372,12 @@ var GitAPI = class {
51373
51372
  }
51374
51373
  };
51375
51374
 
51376
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.4/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
51375
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.5/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
51377
51376
  var import_path = __toESM(require("path"));
51378
51377
  var import_utils6 = require("@modern-js/utils");
51379
51378
  var FS_RESOURCE = "_codesmith_core_fs_resource";
51380
51379
 
51381
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.4/node_modules/@modern-js/codesmith/dist/esm-node/utils/fsExists.js
51380
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.5/node_modules/@modern-js/codesmith/dist/esm-node/utils/fsExists.js
51382
51381
  var import_utils7 = require("@modern-js/utils");
51383
51382
  async function fsExists(path6) {
51384
51383
  try {
@@ -51389,7 +51388,7 @@ async function fsExists(path6) {
51389
51388
  }
51390
51389
  }
51391
51390
 
51392
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.3.4_@modern-js+codesmith@2.3.4/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/utils/renderString.js
51391
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.3.5_@modern-js+codesmith@2.3.5/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/utils/renderString.js
51393
51392
  var import_handlebars = __toESM(require_lib());
51394
51393
  function renderString(template, fullData, registers) {
51395
51394
  const helpers = {
@@ -51403,7 +51402,7 @@ function renderString(template, fullData, registers) {
51403
51402
  return import_handlebars.default.compile(template)(fullData) || "";
51404
51403
  }
51405
51404
 
51406
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.3.4_@modern-js+codesmith@2.3.4/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/index.js
51405
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.3.5_@modern-js+codesmith@2.3.5/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/index.js
51407
51406
  var HandlebarsAPI = class {
51408
51407
  async registerHelp(helpers) {
51409
51408
  this.registers.helpers = {
@@ -51453,13 +51452,13 @@ var HandlebarsAPI = class {
51453
51452
  }
51454
51453
  };
51455
51454
 
51456
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.3.4_@modern-js+codesmith@2.3.4/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/utils/renderString.js
51455
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.3.5_@modern-js+codesmith@2.3.5/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/utils/renderString.js
51457
51456
  var import_ejs = __toESM(require_ejs());
51458
51457
  function renderString2(template, fullData) {
51459
51458
  return import_ejs.default.render(template, fullData) || "";
51460
51459
  }
51461
51460
 
51462
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.3.4_@modern-js+codesmith@2.3.4/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/index.js
51461
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.3.5_@modern-js+codesmith@2.3.5/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/index.js
51463
51462
  var EjsAPI = class {
51464
51463
  async renderTemplate(templateResource, target, parameters = {}) {
51465
51464
  if (templateResource._type !== FS_RESOURCE) {
@@ -51492,7 +51491,7 @@ var EjsAPI = class {
51492
51491
  }
51493
51492
  };
51494
51493
 
51495
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-fs@2.3.4_@modern-js+codesmith@2.3.4/node_modules/@modern-js/codesmith-api-fs/dist/esm-node/index.js
51494
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-fs@2.3.5_@modern-js+codesmith@2.3.5/node_modules/@modern-js/codesmith-api-fs/dist/esm-node/index.js
51496
51495
  var import_path2 = __toESM(require("path"));
51497
51496
  var import_utils10 = require("@modern-js/utils");
51498
51497
  var FsAPI = class {
@@ -61076,10 +61075,10 @@ var Schema = (
61076
61075
  }()
61077
61076
  );
61078
61077
 
61079
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
61078
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
61080
61079
  var import_inquirer = __toESM(require_inquirer());
61081
61080
 
61082
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/transform.js
61081
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/transform.js
61083
61082
  var import_lodash = require("@modern-js/utils/lodash");
61084
61083
  function validateSchema(schema) {
61085
61084
  const { type, properties } = schema;
@@ -61171,7 +61170,7 @@ function transformForm(schema, configValue = {}, validateMap, initValue) {
61171
61170
  return getQuestionFromSchema(schema, configValue, validateMap, initValue);
61172
61171
  }
61173
61172
 
61174
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
61173
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
61175
61174
  var compileRule = (rule, scope) => {
61176
61175
  const state = Schema.compile(rule, {
61177
61176
  $self: {},
@@ -61275,7 +61274,7 @@ async function prompt(schema, configValue = {}, validateMap, initValue) {
61275
61274
  return answers;
61276
61275
  }
61277
61276
 
61278
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/inquirer.js
61277
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/inquirer.js
61279
61278
  var CLIReader = class {
61280
61279
  getAnswers() {
61281
61280
  return this.answers;
@@ -61306,7 +61305,7 @@ var CLIReader = class {
61306
61305
  }
61307
61306
  };
61308
61307
 
61309
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
61308
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
61310
61309
  var import_inquirer2 = __toESM(require_inquirer2());
61311
61310
 
61312
61311
  // ../../../../node_modules/.pnpm/@modern-js+plugin-i18n@2.37.2/node_modules/@modern-js/plugin-i18n/dist/esm-node/index.js
@@ -61372,7 +61371,7 @@ var I18n = class {
61372
61371
  }
61373
61372
  };
61374
61373
 
61375
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/zh.js
61374
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/zh.js
61376
61375
  var ZH_LOCALE = {
61377
61376
  environment: {
61378
61377
  node_version: "请升级 Node 版本至 LIS",
@@ -61399,7 +61398,7 @@ var ZH_LOCALE = {
61399
61398
  }
61400
61399
  };
61401
61400
 
61402
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/en.js
61401
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/en.js
61403
61402
  var EN_LOCALE = {
61404
61403
  environment: {
61405
61404
  node_version: "please upgrade node to lts version",
@@ -61426,14 +61425,14 @@ var EN_LOCALE = {
61426
61425
  }
61427
61426
  };
61428
61427
 
61429
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/index.js
61428
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/index.js
61430
61429
  var i18n = new I18n();
61431
61430
  var localeKeys = i18n.init("zh", {
61432
61431
  zh: ZH_LOCALE,
61433
61432
  en: EN_LOCALE
61434
61433
  });
61435
61434
 
61436
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/transform.js
61435
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/transform.js
61437
61436
  var import_lodash4 = require("@modern-js/utils/lodash");
61438
61437
  function transformInquirerSchema(questions, configValue = {}, validateMap = {}, initValue = {}) {
61439
61438
  for (const question of questions) {
@@ -61461,7 +61460,7 @@ function transformInquirerSchema(questions, configValue = {}, validateMap = {},
61461
61460
  return questions;
61462
61461
  }
61463
61462
 
61464
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/checkUseNvm.js
61463
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/checkUseNvm.js
61465
61464
  var import_path4 = __toESM(require("path"));
61466
61465
  var import_utils12 = require("@modern-js/utils");
61467
61466
  var NODE_MAJOR_VERSION_MAP = {
@@ -61509,7 +61508,7 @@ async function checkUseNvm(cwd, logger) {
61509
61508
  }
61510
61509
  }
61511
61510
 
61512
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.4_@modern-js+codesmith@2.3.4_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
61511
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.5_@modern-js+codesmith@2.3.5_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
61513
61512
  var AppAPI = class {
61514
61513
  async checkEnvironment(nodeVersion) {
61515
61514
  if (import_utils13.semver.lt(process.versions.node, nodeVersion || "12.22.12")) {
@@ -62045,22 +62044,31 @@ var Language;
62045
62044
  })(Language || (Language = {}));
62046
62045
 
62047
62046
  // ../../generator-utils/dist/esm/index.js
62048
- var import_path5 = __toESM(require("path"));
62047
+ var import_path6 = __toESM(require("path"));
62049
62048
  var import_utils15 = require("@modern-js/utils");
62050
- var import_utils16 = require("@modern-js/utils");
62051
- function isTsProject(appDir) {
62052
- return import_utils15.fs.existsSync(import_path5.default.join(appDir, "tsconfig.json"));
62053
- }
62054
62049
 
62055
- // src/index.ts
62056
- var getGeneratorPath = (generator, distTag) => {
62050
+ // ../../generator-utils/dist/esm/utils/getGeneratorPath.js
62051
+ var import_path5 = __toESM(require("path"));
62052
+ var getGeneratorPath = (generator, distTag, paths) => {
62057
62053
  if (process.env.CODESMITH_ENV === "development") {
62058
- return import_path6.default.dirname(require.resolve(generator));
62054
+ return import_path5.default.dirname(require.resolve(generator, {
62055
+ paths: paths !== null && paths !== void 0 ? paths : [
62056
+ process.cwd()
62057
+ ]
62058
+ }));
62059
62059
  } else if (distTag) {
62060
62060
  return `${generator}@${distTag}`;
62061
62061
  }
62062
62062
  return generator;
62063
62063
  };
62064
+
62065
+ // ../../generator-utils/dist/esm/index.js
62066
+ var import_utils16 = require("@modern-js/utils");
62067
+ function isTsProject(appDir) {
62068
+ return import_utils15.fs.existsSync(import_path6.default.join(appDir, "tsconfig.json"));
62069
+ }
62070
+
62071
+ // src/index.ts
62064
62072
  var handleTemplateFile = async (context, generator, appApi) => {
62065
62073
  const appDir = context.materials.default.basePath;
62066
62074
  const language = isTsProject(appDir) ? Language.TS : Language.JS;
@@ -62089,7 +62097,7 @@ var handleTemplateFile = async (context, generator, appApi) => {
62089
62097
  devDependencies.tailwindcss = tailwindVersion;
62090
62098
  }
62091
62099
  await appApi.runSubGenerator(
62092
- getGeneratorPath(DependenceGenerator, context.config.distTag),
62100
+ getGeneratorPath(DependenceGenerator, context.config.distTag, [__dirname]),
62093
62101
  void 0,
62094
62102
  {
62095
62103
  ...context.config,
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.3.9",
18
+ "version": "3.3.11",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "main": "./dist/index.js",
21
21
  "files": [
@@ -23,20 +23,20 @@
23
23
  "/dist/index.js"
24
24
  ],
25
25
  "dependencies": {
26
- "@modern-js/utils": "2.47.0"
26
+ "@modern-js/utils": "2.48.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@modern-js/codesmith": "2.3.4",
30
- "@modern-js/codesmith-api-app": "2.3.4",
29
+ "@modern-js/codesmith": "2.3.5",
30
+ "@modern-js/codesmith-api-app": "2.3.5",
31
31
  "@types/jest": "^29",
32
32
  "@types/node": "^14",
33
33
  "jest": "^29",
34
34
  "typescript": "^5",
35
- "@modern-js/dependence-generator": "3.3.9",
36
- "@scripts/build": "2.47.0",
37
- "@modern-js/generator-common": "3.3.9",
38
- "@modern-js/generator-utils": "3.3.9",
39
- "@scripts/jest-config": "2.47.0"
35
+ "@modern-js/dependence-generator": "3.3.11",
36
+ "@modern-js/generator-common": "3.3.11",
37
+ "@modern-js/generator-utils": "3.3.11",
38
+ "@scripts/jest-config": "2.48.0",
39
+ "@scripts/build": "2.48.0"
40
40
  },
41
41
  "sideEffects": false,
42
42
  "publishConfig": {
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- import path from 'path';
2
1
  import { GeneratorContext, GeneratorCore } from '@modern-js/codesmith';
3
2
  import { AppAPI } from '@modern-js/codesmith-api-app';
4
3
  import {
@@ -6,16 +5,7 @@ import {
6
5
  Language,
7
6
  DependenceGenerator,
8
7
  } from '@modern-js/generator-common';
9
- import { isTsProject } from '@modern-js/generator-utils';
10
-
11
- const getGeneratorPath = (generator: string, distTag: string) => {
12
- if (process.env.CODESMITH_ENV === 'development') {
13
- return path.dirname(require.resolve(generator));
14
- } else if (distTag) {
15
- return `${generator}@${distTag}`;
16
- }
17
- return generator;
18
- };
8
+ import { isTsProject, getGeneratorPath } from '@modern-js/generator-utils';
19
9
 
20
10
  export const handleTemplateFile = async (
21
11
  context: GeneratorContext,
@@ -49,7 +39,7 @@ export const handleTemplateFile = async (
49
39
  devDependencies.tailwindcss = tailwindVersion;
50
40
  }
51
41
  await appApi.runSubGenerator(
52
- getGeneratorPath(DependenceGenerator, context.config.distTag),
42
+ getGeneratorPath(DependenceGenerator, context.config.distTag, [__dirname]),
53
43
  undefined,
54
44
  {
55
45
  ...context.config,