@mui/internal-code-infra 0.0.4-canary.95 → 0.0.4-canary.96

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.
@@ -2,14 +2,14 @@
2
2
  export type PublicPackage = import('../utils/pnpm.mjs').PublicPackage;
3
3
  export type Args = {
4
4
  publicOnly?: boolean;
5
- output?: 'json' | 'path' | 'name';
5
+ output?: 'json' | 'path' | 'name' | 'publish-dir';
6
6
  sinceRef?: string;
7
7
  filter?: string[];
8
8
  };
9
9
  /**
10
10
  * @typedef {Object} Args
11
11
  * @property {boolean} [publicOnly] - Whether to filter to only public packages
12
- * @property {'json'|'path'|'name'} [output] - Output format (name, path, or json)
12
+ * @property {'json'|'path'|'name'|'publish-dir'} [output] - Output format (name, path, or json)
13
13
  * @property {string} [sinceRef] - Git reference to filter changes since
14
14
  * @property {string[]} [filter] - Same as filtering packages with --filter in pnpm. Only include packages matching the filter. See https://pnpm.io/filtering.
15
15
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-code-infra",
3
- "version": "0.0.4-canary.95",
3
+ "version": "0.0.4-canary.96",
4
4
  "author": "MUI Team",
5
5
  "description": "Infra scripts and configs to be used across MUI repos.",
6
6
  "license": "MIT",
@@ -135,9 +135,9 @@
135
135
  "unist-util-visit": "^5.1.0",
136
136
  "yaml": "^2.9.0",
137
137
  "yargs": "^18.0.0",
138
+ "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.30",
138
139
  "@mui/internal-babel-plugin-display-name": "1.0.4-canary.23",
139
- "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.40",
140
- "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.30"
140
+ "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.40"
141
141
  },
142
142
  "peerDependencies": {
143
143
  "@next/eslint-plugin-next": "*",
@@ -188,7 +188,7 @@
188
188
  "publishConfig": {
189
189
  "access": "public"
190
190
  },
191
- "gitSha": "446bfbb8d10f0a108322553b707a5f54d2993c24",
191
+ "gitSha": "60d82ed47492f8c7954adcdd4be4016bb74ab764",
192
192
  "scripts": {
193
193
  "build": "tsgo -p tsconfig.build.json",
194
194
  "typescript": "tsgo -noEmit",
@@ -6,12 +6,14 @@
6
6
  * @typedef {import('../utils/pnpm.mjs').PublicPackage} PublicPackage
7
7
  */
8
8
 
9
+ import * as fs from 'node:fs/promises';
10
+ import * as path from 'node:path';
9
11
  import { getWorkspacePackages } from '../utils/pnpm.mjs';
10
12
 
11
13
  /**
12
14
  * @typedef {Object} Args
13
15
  * @property {boolean} [publicOnly] - Whether to filter to only public packages
14
- * @property {'json'|'path'|'name'} [output] - Output format (name, path, or json)
16
+ * @property {'json'|'path'|'name'|'publish-dir'} [output] - Output format (name, path, or json)
15
17
  * @property {string} [sinceRef] - Git reference to filter changes since
16
18
  * @property {string[]} [filter] - Same as filtering packages with --filter in pnpm. Only include packages matching the filter. See https://pnpm.io/filtering.
17
19
  */
@@ -28,10 +30,10 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
28
30
  })
29
31
  .option('output', {
30
32
  type: 'string',
31
- choices: ['json', 'path', 'name'],
33
+ choices: ['json', 'path', 'name', 'publish-dir'],
32
34
  default: 'path',
33
35
  description:
34
- 'Output format: name (package names), path (package paths), or json (full JSON)',
36
+ 'Output format: name (package names), path (package paths), publish-dir (publish directories), or json (full JSON)',
35
37
  })
36
38
  .option('since-ref', {
37
39
  type: 'string',
@@ -58,6 +60,32 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
58
60
  packages.forEach((pkg) => {
59
61
  console.log(pkg.path);
60
62
  });
63
+ } else if (output === 'publish-dir') {
64
+ // Works around https://github.com/stackblitz-labs/pkg.pr.new/issues/389: pkg-pr-new rewrites
65
+ // workspace:* deps to its URLs in the source package.json, but `pnpm pack` honors
66
+ // publishConfig.directory and packs the build package.json, whose workspace:* deps are left to
67
+ // resolve to plain versions. Pointing pkg-pr-new at the build dir makes both act on the same file.
68
+ // Note: #389 was closed by pkg-pr-new#499, but that only fixed the tarball location, not the dep
69
+ // resolution — verified still broken on 0.0.78. Do not remove until the packed deps are URLs
70
+ // without this. Removing it prematurely regressed publishing once (see mui-public#1354).
71
+ // Print publish directories (package.json publishConfig.directory or package path)
72
+ const publishDirs = await Promise.all(
73
+ packages.map(async (pkg) => {
74
+ const packageJsonPath = path.join(pkg.path, 'package.json');
75
+ const packageJsonContent = await fs.readFile(packageJsonPath, 'utf8');
76
+ const packageJson = JSON.parse(packageJsonContent);
77
+
78
+ if (packageJson.publishConfig?.directory) {
79
+ return path.join(pkg.path, packageJson.publishConfig.directory);
80
+ }
81
+
82
+ return pkg.path;
83
+ }),
84
+ );
85
+
86
+ publishDirs.forEach((dir) => {
87
+ console.log(dir);
88
+ });
61
89
  } else if (output === 'name') {
62
90
  // Print package names (default)
63
91
  packages.forEach((pkg) => {