@deot/dev-builder 2.8.1 → 2.9.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.cjs CHANGED
@@ -44,7 +44,7 @@ const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
44
44
  const fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs$1);
45
45
  const sass__namespace = /*#__PURE__*/_interopNamespaceDefault(sass);
46
46
 
47
- const dirname$1 = path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
47
+ const dirname$1 = path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
48
48
  const run$3 = async (options) => {
49
49
  const locals = devShared.Locals.impl();
50
50
  const { cwd, workspace } = locals;
@@ -62,8 +62,7 @@ const run$3 = async (options) => {
62
62
  const { scriptFormats, external, globals } = commandOptions;
63
63
  const stats = [];
64
64
  const files = fs.existsSync(srcDir) ? fs.readdirSync(srcDir).filter((i) => /^index\.(.*)\.?(t|j)s$/.test(i)) : [];
65
- if (!files.length)
66
- return stats;
65
+ if (!files.length) return stats;
67
66
  const build = async (format, filepath) => {
68
67
  const buildOptions = {
69
68
  files: [filepath],
@@ -162,7 +161,7 @@ const run$2 = async (options) => {
162
161
  return stats;
163
162
  };
164
163
 
165
- const dirname = path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
164
+ const dirname = path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
166
165
  const run$1 = async (options) => {
167
166
  const { workspace, packageDir: packageRootDir } = devShared.Locals.impl();
168
167
  const { isVuePackage, packageDir, packageOutDir, packageSourceDir, packageOptions, commandOptions } = options;
@@ -214,6 +213,7 @@ const run$1 = async (options) => {
214
213
  const configPath = `${tempDir}/api-extractor.json`;
215
214
  fs.outputFileSync(configPath, JSON.stringify({
216
215
  extends: path__namespace.relative(tempDir, path__namespace.resolve(dirname, "../api-extractor.shared.json")),
216
+ // eslint-disable-next-line @stylistic/max-len
217
217
  mainEntryPointFilePath: (workspace ? `./${workspace}/` : "./") + path__namespace.relative(packageRootDir, `${packageSourceDir}/index.d.ts`),
218
218
  // workspace、时以temp/packages/*/src结构,否则APIExtractor会报错
219
219
  dtsRollup: {
@@ -300,8 +300,7 @@ class Build {
300
300
  return;
301
301
  }
302
302
  const files = fs.existsSync(srcDir) ? fs.readdirSync(srcDir).filter((i) => /^index(.*)\.(ts|js|s?css)$/.test(i)) : [];
303
- if (!files.length)
304
- return;
303
+ if (!files.length) return;
305
304
  const spinner = ora(`${packageName} Build ...`);
306
305
  try {
307
306
  spinner.start();
@@ -352,11 +351,11 @@ const run = (options) => devShared.Utils.autoCatch(async () => {
352
351
  if (locals.workspace && packageFolderName === "*") {
353
352
  inputs = locals.normalizePackageFolderNames;
354
353
  } else {
355
- inputs = [packageFolderName];
354
+ inputs = packageFolderName.split(",");
356
355
  }
357
- if (options.packageName && options.packageName !== "*") {
356
+ if (locals.workspace && options.packageName && options.packageName !== "*") {
358
357
  let relations = [];
359
- const walk = (packageNames) => {
358
+ const walk = (packageNames = []) => {
360
359
  relations = packageNames.concat(relations);
361
360
  packageNames.forEach((i) => {
362
361
  if (locals.packageRelation[i].length) {
@@ -364,7 +363,9 @@ const run = (options) => devShared.Utils.autoCatch(async () => {
364
363
  }
365
364
  });
366
365
  };
367
- walk(locals.packageRelation[options.packageName]);
366
+ options.packageName.split(",").forEach((packageName$) => {
367
+ walk(locals.packageRelation[packageName$]);
368
+ });
368
369
  relations = relations.filter((i, index, source) => source.indexOf(i) === index).map((i) => devShared.Locals.getPackageFolderName(i)).filter((i) => {
369
370
  try {
370
371
  return options.dryRun || !fs__namespace.existsSync(path__namespace.resolve(locals.packageDir, i, "dist"));
@@ -374,8 +375,7 @@ const run = (options) => devShared.Utils.autoCatch(async () => {
374
375
  });
375
376
  inputs = relations.concat(inputs);
376
377
  }
377
- if (options.dryRun)
378
- return devShared.Shell.spawn(`echo ${inputs.join(" ")}`);
378
+ if (options.dryRun) return devShared.Shell.spawn(`echo ${inputs.join(" ")}`);
379
379
  await inputs.reduce(
380
380
  (preProcess, packageFolderName$) => {
381
381
  preProcess = preProcess.then(() => build(packageFolderName$, options).process());
package/dist/index.js CHANGED
@@ -36,8 +36,7 @@ const run$3 = async (options) => {
36
36
  const { scriptFormats, external, globals } = commandOptions;
37
37
  const stats = [];
38
38
  const files = fs$1.existsSync(srcDir) ? fs$1.readdirSync(srcDir).filter((i) => /^index\.(.*)\.?(t|j)s$/.test(i)) : [];
39
- if (!files.length)
40
- return stats;
39
+ if (!files.length) return stats;
41
40
  const build = async (format, filepath) => {
42
41
  const buildOptions = {
43
42
  files: [filepath],
@@ -188,6 +187,7 @@ const run$1 = async (options) => {
188
187
  const configPath = `${tempDir}/api-extractor.json`;
189
188
  fs$1.outputFileSync(configPath, JSON.stringify({
190
189
  extends: path.relative(tempDir, path.resolve(dirname, "../api-extractor.shared.json")),
190
+ // eslint-disable-next-line @stylistic/max-len
191
191
  mainEntryPointFilePath: (workspace ? `./${workspace}/` : "./") + path.relative(packageRootDir, `${packageSourceDir}/index.d.ts`),
192
192
  // workspace、时以temp/packages/*/src结构,否则APIExtractor会报错
193
193
  dtsRollup: {
@@ -274,8 +274,7 @@ class Build {
274
274
  return;
275
275
  }
276
276
  const files = fs$1.existsSync(srcDir) ? fs$1.readdirSync(srcDir).filter((i) => /^index(.*)\.(ts|js|s?css)$/.test(i)) : [];
277
- if (!files.length)
278
- return;
277
+ if (!files.length) return;
279
278
  const spinner = ora(`${packageName} Build ...`);
280
279
  try {
281
280
  spinner.start();
@@ -326,11 +325,11 @@ const run = (options) => Utils.autoCatch(async () => {
326
325
  if (locals.workspace && packageFolderName === "*") {
327
326
  inputs = locals.normalizePackageFolderNames;
328
327
  } else {
329
- inputs = [packageFolderName];
328
+ inputs = packageFolderName.split(",");
330
329
  }
331
- if (options.packageName && options.packageName !== "*") {
330
+ if (locals.workspace && options.packageName && options.packageName !== "*") {
332
331
  let relations = [];
333
- const walk = (packageNames) => {
332
+ const walk = (packageNames = []) => {
334
333
  relations = packageNames.concat(relations);
335
334
  packageNames.forEach((i) => {
336
335
  if (locals.packageRelation[i].length) {
@@ -338,7 +337,9 @@ const run = (options) => Utils.autoCatch(async () => {
338
337
  }
339
338
  });
340
339
  };
341
- walk(locals.packageRelation[options.packageName]);
340
+ options.packageName.split(",").forEach((packageName$) => {
341
+ walk(locals.packageRelation[packageName$]);
342
+ });
342
343
  relations = relations.filter((i, index, source) => source.indexOf(i) === index).map((i) => Locals.getPackageFolderName(i)).filter((i) => {
343
344
  try {
344
345
  return options.dryRun || !fs.existsSync(path.resolve(locals.packageDir, i, "dist"));
@@ -348,8 +349,7 @@ const run = (options) => Utils.autoCatch(async () => {
348
349
  });
349
350
  inputs = relations.concat(inputs);
350
351
  }
351
- if (options.dryRun)
352
- return Shell.spawn(`echo ${inputs.join(" ")}`);
352
+ if (options.dryRun) return Shell.spawn(`echo ${inputs.join(" ")}`);
353
353
  await inputs.reduce(
354
354
  (preProcess, packageFolderName$) => {
355
355
  preProcess = preProcess.then(() => build(packageFolderName$, options).process());
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@deot/dev-builder",
3
- "version": "2.8.1",
3
+ "version": "2.9.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
+ "types": "./dist/index.d.ts",
9
10
  "import": "./dist/index.js",
10
- "require": "./dist/index.cjs",
11
- "types": "./dist/index.d.ts"
11
+ "require": "./dist/index.cjs"
12
12
  }
13
13
  },
14
14
  "files": [
@@ -29,23 +29,23 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@deot/dev-react": "^2.8.0",
33
- "@deot/dev-shared": "^2.8.0",
34
- "@deot/dev-vue": "^2.8.0",
35
- "@microsoft/api-extractor": "^7.38.5",
36
- "autoprefixer": "^10.4.16",
37
- "chalk": "^5.3.0",
38
- "cssnano": "^6.0.1",
39
- "fs-extra": "^11.2.0",
40
- "ora": "^7.0.1",
41
- "postcss": "^8.4.32",
32
+ "@deot/dev-react": "^2.9.0",
33
+ "@deot/dev-shared": "^2.9.0",
34
+ "@deot/dev-vue": "^2.9.0",
35
+ "@microsoft/api-extractor": "^7.50.0",
36
+ "autoprefixer": "^10.4.20",
37
+ "chalk": "^5.4.1",
38
+ "cssnano": "^7.0.6",
39
+ "fs-extra": "^11.3.0",
40
+ "ora": "^8.2.0",
41
+ "postcss": "^8.5.2",
42
42
  "postcss-flexbugs-fixes": "^5.0.2",
43
- "postcss-import": "^15.1.0",
43
+ "postcss-import": "^16.1.0",
44
44
  "postcss-url": "^10.1.3",
45
- "sass": "^1.69.5",
46
- "vite": "^5.0.8"
45
+ "sass": "^1.84.0",
46
+ "vite": "^6.1.0"
47
47
  },
48
48
  "devDependencies": {
49
- "typescript": "^5.3.3"
49
+ "typescript": "^5.7.3"
50
50
  }
51
51
  }
package/shared.config.ts CHANGED
@@ -37,8 +37,8 @@ const external$ = !usedForBrowser
37
37
  .map(i => new RegExp(`^${i}$`))
38
38
  ]
39
39
  : external.split(',')
40
- .filter((i: string) => !!i)
41
- .map((i: string) => new RegExp(`^${i}$`));
40
+ .filter((i: string) => !!i)
41
+ .map((i: string) => new RegExp(`^${i}$`));
42
42
 
43
43
  // alias
44
44
  const replacement = (name: string) => path.resolve(cwd, `./packages/${name}`);
@@ -84,6 +84,7 @@ export default defineConfig({
84
84
  minify: false,
85
85
  target: 'esnext',
86
86
  lib: {
87
+ cssFileName: 'style',
87
88
  entry: files.map((file: string) => path.resolve(packageSourceDir, file)),
88
89
  formats: [format],
89
90
  name: getGlobalName(packageName)