Conversation
- Add `sideEffects: false` to published package manifests - Improve security audit tsconfig strictness detection
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Unresolved git merge conflict markers in script
- Removed conflict markers and the duplicate loadTsconfig block, keeping tsconfig assignment plus the existing TypeScript getParsedCommandLineOfConfigFile strict check.
- ✅ Fixed: CSS exports will be tree-shaken with sideEffects false
- Changed preview package sideEffects from false to ["**/*.css"] so CSS theme imports are treated as side-effectful and not dropped by tree-shaking.
Or push these changes by commenting:
@cursor push ea7257e13a
Preview (ea7257e13a)
diff --git a/packages/preview/package.json b/packages/preview/package.json
--- a/packages/preview/package.json
+++ b/packages/preview/package.json
@@ -23,7 +23,7 @@
"typescript"
],
"type": "module",
- "sideEffects": false,
+ "sideEffects": ["**/*.css"],
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
diff --git a/scripts/security-audit.sh b/scripts/security-audit.sh
--- a/scripts/security-audit.sh
+++ b/scripts/security-audit.sh
@@ -464,144 +464,8 @@
for pkg_dir in packages/*/; do
pkg_name="$(basename "$pkg_dir")"
-<<<<<<< Updated upstream
tsconfig="$pkg_dir/tsconfig.json"
-=======
- IS_STRICT="$(node - "$tsconfig" <<'NODE'
-const fs = require('fs');
-const path = require('path');
-function stripJsonComments(input) {
- const source = input.replace(/^\uFEFF/, '');
- let result = '';
- let inString = false;
- let stringQuote = '';
- let escaping = false;
- let inLineComment = false;
- let inBlockComment = false;
-
- for (let i = 0; i < source.length; i += 1) {
- const char = source[i];
- const next = source[i + 1];
-
- if (inLineComment) {
- if (char === '\n') {
- inLineComment = false;
- result += char;
- }
- continue;
- }
-
- if (inBlockComment) {
- if (char === '*' && next === '/') {
- inBlockComment = false;
- i += 1;
- }
- continue;
- }
-
- if (inString) {
- result += char;
- if (escaping) {
- escaping = false;
- } else if (char === '\\') {
- escaping = true;
- } else if (char === stringQuote) {
- inString = false;
- stringQuote = '';
- }
- continue;
- }
-
- if ((char === '"' || char === "'")) {
- inString = true;
- stringQuote = char;
- result += char;
- continue;
- }
-
- if (char === '/' && next === '/') {
- inLineComment = true;
- i += 1;
- continue;
- }
-
- if (char === '/' && next === '*') {
- inBlockComment = true;
- i += 1;
- continue;
- }
-
- result += char;
- }
-
- return result;
-}
-
-function loadTsconfig(tsconfigPath, visited = new Set()) {
- const resolvedPath = path.resolve(tsconfigPath);
- if (visited.has(resolvedPath)) {
- throw new Error(`Circular tsconfig extends detected: ${resolvedPath}`);
- }
-
- visited.add(resolvedPath);
-
- const raw = fs.readFileSync(resolvedPath, 'utf8');
- const parsed = JSON.parse(stripJsonComments(raw));
- const baseConfig = parsed.extends
- ? loadExtendedTsconfig(parsed.extends, path.dirname(resolvedPath), visited)
- : {};
-
- return {
- ...baseConfig,
- ...parsed,
- compilerOptions: {
- ...(baseConfig.compilerOptions || {}),
- ...(parsed.compilerOptions || {}),
- },
- };
-}
-
-function loadExtendedTsconfig(extendsValue, configDir, visited) {
- const candidates = [];
-
- if (extendsValue.startsWith('.')) {
- candidates.push(path.resolve(configDir, extendsValue));
- } else if (path.isAbsolute(extendsValue)) {
- candidates.push(extendsValue);
- } else {
- candidates.push(path.resolve(configDir, extendsValue));
- }
-
- for (const candidate of [...candidates]) {
- if (!candidate.endsWith('.json')) {
- candidates.push(`${candidate}.json`);
- }
- }
-
- for (const candidate of candidates) {
- if (fs.existsSync(candidate)) {
- return loadTsconfig(candidate, visited);
- }
- }
-
- throw new Error(`Unable to resolve extended tsconfig: ${extendsValue}`);
-}
-
-try {
- const config = loadTsconfig(process.argv[2]);
- if (config.compilerOptions?.strict === true) {
- process.stdout.write('true');
- } else {
- process.stdout.write('false');
- }
-} catch {
- process.stdout.write('unknown');
-}
-NODE
-)"
->>>>>>> Stashed changes
-
if [ ! -f "$tsconfig" ]; then
record_warn "$pkg_name: no tsconfig.json found"
continueYou can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 25008df. Configure here.
…effects Remove accidental conflict markers and duplicate strict-check block from security-audit.sh, keeping tsconfig assignment and TypeScript API parsing. Set preview package sideEffects to **/*.css so theme CSS imports are not tree-shaken by bundlers.
Keep the tsconfig variable assignment and the TypeScript API-based parser (getParsedCommandLineOfConfigFile) which natively handles extends resolution. Remove the conflicting custom Node.js tsconfig resolver that was accidentally committed with merge-conflict markers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
…effects Remove accidental conflict markers and duplicate strict-check block from security-audit.sh, keeping tsconfig assignment and TypeScript API parsing. Set preview package sideEffects to **/*.css so theme CSS imports are not tree-shaken by bundlers. Applied via @cursor push command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
create-markdownpackages to2.0.2and synced version references in the README and docs.sideEffectsmetadata for cleaner downstream resolution and better tree-shaking.>=2.0.2where applicable.tsconfigsettings.2.0.2publish.Testing
Note
Low Risk
Low risk metadata-only change; main potential impact is if any package has untracked side effects (especially CSS) that bundlers may now drop.
Overview
Adds
sideEffectsmetadata across published packages to improve downstream tree-shaking:falseforcore,react,mdx, andcreate-markdown, and['**/*.css']forpreviewto preserve CSS imports.Reviewed by Cursor Bugbot for commit 61fa528. Bugbot is set up for automated code reviews on this repo. Configure here.