sonda 0.13.0 → 0.14.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c2bff35: Add warnings about circular imports.
8
+ - db98c29: Add warnings about duplicated dependencies.
9
+
10
+ ### Patch Changes
11
+
12
+ - 8bebd30: Print a warning when using Sonda in a Next.js project that builds with Turbopack.
13
+ - 4fb2b99: Fixed `dependencies` entries to ignore package paths that do not exist on disk.
14
+
15
+ ## 0.13.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 6e692b5: Fixed missing lazy-loaded JavaScript files in reports for SvelteKit and other Vite-based builds.
20
+
3
21
  ## 0.13.0
4
22
 
5
23
  ### Minor Changes
@@ -1,5 +1,7 @@
1
+ import { styleText } from "util";
1
2
  import { Config, SondaWebpackPlugin } from "sonda";
2
3
  //#region src/entrypoints/next.ts
4
+ let turbopackWarningShown = false;
3
5
  function SondaNextPlugin(userOptions = {}) {
4
6
  return function Sonda(nextConfig = {}) {
5
7
  const options = new Config(userOptions, {
@@ -7,6 +9,7 @@ function SondaNextPlugin(userOptions = {}) {
7
9
  filename: "sonda_[env]_[index]"
8
10
  });
9
11
  if (!options.enabled) return nextConfig;
12
+ warnIfTurbopackIsUsed();
10
13
  return Object.assign({}, nextConfig, { webpack(config, { nextRuntime, isServer }) {
11
14
  const env = nextRuntime || "client";
12
15
  if (env === "edge" || isServer && !options.server) return config;
@@ -17,5 +20,11 @@ function SondaNextPlugin(userOptions = {}) {
17
20
  } });
18
21
  };
19
22
  }
23
+ function warnIfTurbopackIsUsed() {
24
+ const args = process.argv.slice(2);
25
+ if (turbopackWarningShown || !args.includes("build") || args.includes("--webpack")) return;
26
+ turbopackWarningShown = true;
27
+ console.warn(styleText("red", "Sonda does not support Next.js builds with Turbopack yet. Run `next build --webpack` to generate Sonda reports."));
28
+ }
20
29
  //#endregion
21
30
  export { SondaNextPlugin as default };
@@ -1,6 +1,6 @@
1
1
  import { UserOptions } from "sonda";
2
2
 
3
- //#region ../../node_modules/.pnpm/rolldown@1.1.0/node_modules/rolldown/dist/shared/logging-BSNejiLS.d.mts
3
+ //#region ../../node_modules/.pnpm/rolldown@1.1.4/node_modules/rolldown/dist/shared/logging-BSNejiLS.d.mts
4
4
  //#region src/log/logging.d.ts
5
5
  /** @inline */
6
6
  type LogLevel = "info" | "debug" | "warn";
@@ -50,7 +50,7 @@ interface RolldownError extends RolldownLog {
50
50
  }
51
51
  type LogOrStringHandler = (level: LogLevelWithError, log: RolldownLogWithString) => void; //#endregion
52
52
  //#endregion
53
- //#region ../../node_modules/.pnpm/@oxc-project+types@0.134.0/node_modules/@oxc-project/types/types.d.ts
53
+ //#region ../../node_modules/.pnpm/@oxc-project+types@0.138.0/node_modules/@oxc-project/types/types.d.ts
54
54
  // Auto-generated code, DO NOT EDIT DIRECTLY!
55
55
  // To edit this generated file you have to edit `tasks/ast_tools/src/generators/typescript.rs`.
56
56
  interface Program extends Span {
@@ -1349,7 +1349,7 @@ type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete";
1349
1349
  type UpdateOperator = "++" | "--";
1350
1350
  type Node = Program | IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | ThisExpression | ArrayExpression | ObjectExpression | ObjectProperty | TemplateLiteral | TaggedTemplateExpression | TemplateElement | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression | CallExpression | NewExpression | MetaProperty | SpreadElement | UpdateExpression | UnaryExpression | BinaryExpression | PrivateInExpression | LogicalExpression | ConditionalExpression | AssignmentExpression | ArrayAssignmentTarget | ObjectAssignmentTarget | AssignmentTargetRest | AssignmentTargetWithDefault | AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty | SequenceExpression | Super | AwaitExpression | ChainExpression | ParenthesizedExpression | Directive | Hashbang | BlockStatement | VariableDeclaration | VariableDeclarator | EmptyStatement | ExpressionStatement | IfStatement | DoWhileStatement | WhileStatement | ForStatement | ForInStatement | ForOfStatement | ContinueStatement | BreakStatement | ReturnStatement | WithStatement | SwitchStatement | SwitchCase | LabeledStatement | ThrowStatement | TryStatement | CatchClause | DebuggerStatement | AssignmentPattern | ObjectPattern | BindingProperty | ArrayPattern | BindingRestElement | Function | FunctionBody | ArrowFunctionExpression | YieldExpression | Class | ClassBody | MethodDefinition | PropertyDefinition | PrivateIdentifier | StaticBlock | AccessorProperty | ImportExpression | ImportDeclaration | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportAttribute | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExportSpecifier | V8IntrinsicExpression | BooleanLiteral | NullLiteral | NumericLiteral | StringLiteral | BigIntLiteral | RegExpLiteral | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXOpeningFragment | JSXClosingFragment | JSXNamespacedName | JSXMemberExpression | JSXExpressionContainer | JSXEmptyExpression | JSXAttribute | JSXSpreadAttribute | JSXIdentifier | JSXSpreadChild | JSXText | TSThisParameter | TSEnumDeclaration | TSEnumBody | TSEnumMember | TSTypeAnnotation | TSLiteralType | TSConditionalType | TSUnionType | TSIntersectionType | TSParenthesizedType | TSTypeOperator | TSArrayType | TSIndexedAccessType | TSTupleType | TSNamedTupleMember | TSOptionalType | TSRestType | TSAnyKeyword | TSStringKeyword | TSBooleanKeyword | TSNumberKeyword | TSNeverKeyword | TSIntrinsicKeyword | TSUnknownKeyword | TSNullKeyword | TSUndefinedKeyword | TSVoidKeyword | TSSymbolKeyword | TSThisType | TSObjectKeyword | TSBigIntKeyword | TSTypeReference | TSQualifiedName | TSTypeParameterInstantiation | TSTypeParameter | TSTypeParameterDeclaration | TSTypeAliasDeclaration | TSClassImplements | TSInterfaceDeclaration | TSInterfaceBody | TSPropertySignature | TSIndexSignature | TSCallSignatureDeclaration | TSMethodSignature | TSConstructSignatureDeclaration | TSIndexSignatureName | TSInterfaceHeritage | TSTypePredicate | TSModuleDeclaration | TSGlobalDeclaration | TSModuleBlock | TSTypeLiteral | TSInferType | TSTypeQuery | TSImportType | TSImportTypeQualifiedName | TSFunctionType | TSConstructorType | TSMappedType | TSTemplateLiteralType | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSImportEqualsDeclaration | TSExternalModuleReference | TSNonNullExpression | Decorator | TSExportAssignment | TSNamespaceExportDeclaration | TSInstantiationExpression | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType | ParamPattern;
1351
1351
  //#endregion
1352
- //#region ../../node_modules/.pnpm/rolldown@1.1.0/node_modules/rolldown/dist/shared/binding-BaCZTfMx.d.mts
1352
+ //#region ../../node_modules/.pnpm/rolldown@1.1.4/node_modules/rolldown/dist/shared/binding-B1q9aYT-.d.mts
1353
1353
  interface CodegenOptions {
1354
1354
  /**
1355
1355
  * Remove whitespace.
@@ -1385,7 +1385,7 @@ interface CompressOptions {
1385
1385
  *
1386
1386
  * @default 'esnext'
1387
1387
  *
1388
- * @see [esbuild#target](https://esbuild.github.io/api/#target)
1388
+ * @see [oxc#target](https://oxc.rs/docs/guide/usage/transformer/lowering#target)
1389
1389
  */
1390
1390
  target?: string | Array<string>;
1391
1391
  /**
@@ -1843,7 +1843,10 @@ interface StyledComponentsOptions {
1843
1843
  * Transpiles styled-components tagged template literals to a smaller representation
1844
1844
  * than what Babel normally creates, helping to reduce bundle size.
1845
1845
  *
1846
- * @default true
1846
+ * Disabled by default because Oxc does not down-level template literals, so this
1847
+ * transform only increases output size.
1848
+ *
1849
+ * @default false
1847
1850
  */
1848
1851
  transpileTemplateLiterals?: boolean;
1849
1852
  /**
@@ -1893,6 +1896,13 @@ interface StyledComponentsOptions {
1893
1896
  /**
1894
1897
  * Options for transforming a JavaScript or TypeScript file.
1895
1898
  *
1899
+ * Options are listed in evaluation order: the source is parsed (`lang`,
1900
+ * `sourceType`), declarations are emitted (`typescript.declaration`), then
1901
+ * transforms run (`typescript`, `decorator`, `plugins`,
1902
+ * `jsx`, `target`), followed by the `inject` and `define` plugins, and
1903
+ * finally codegen (`sourcemap`). `helpers` configures the runtime helpers
1904
+ * the transforms emit.
1905
+ *
1896
1906
  * @see {@link transform}
1897
1907
  */
1898
1908
  interface TransformOptions$1 {
@@ -1905,23 +1915,23 @@ interface TransformOptions$1 {
1905
1915
  * options.
1906
1916
  */
1907
1917
  cwd?: string;
1908
- /**
1909
- * Enable source map generation.
1910
- *
1911
- * When `true`, the `sourceMap` field of transform result objects will be populated.
1912
- *
1913
- * @default false
1914
- *
1915
- * @see {@link SourceMap}
1916
- */
1917
- sourcemap?: boolean;
1918
1918
  /** Set assumptions in order to produce smaller output. */
1919
1919
  assumptions?: CompilerAssumptions;
1920
1920
  /**
1921
1921
  * Configure how TypeScript is transformed.
1922
+ *
1923
+ * `typescript.declaration` is evaluated before all transforms.
1924
+ *
1922
1925
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
1923
1926
  */
1924
1927
  typescript?: TypeScriptOptions;
1928
+ /** Decorator plugin */
1929
+ decorator?: DecoratorOptions;
1930
+ /**
1931
+ * Third-party plugins to use.
1932
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
1933
+ */
1934
+ plugins?: PluginsOptions;
1925
1935
  /**
1926
1936
  * Configure how TSX and JSX are transformed.
1927
1937
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
@@ -1944,23 +1954,32 @@ interface TransformOptions$1 {
1944
1954
  target?: string | Array<string>;
1945
1955
  /** Behaviour for runtime helpers. */
1946
1956
  helpers?: Helpers;
1947
- /**
1948
- * Define Plugin
1949
- * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
1950
- */
1951
- define?: Record<string, string>;
1952
1957
  /**
1953
1958
  * Inject Plugin
1959
+ *
1960
+ * Runs after all transforms.
1961
+ *
1954
1962
  * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
1955
1963
  */
1956
1964
  inject?: Record<string, string | [string, string]>;
1957
- /** Decorator plugin */
1958
- decorator?: DecoratorOptions;
1959
1965
  /**
1960
- * Third-party plugins to use.
1961
- * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
1966
+ * Define Plugin
1967
+ *
1968
+ * Runs after the inject plugin.
1969
+ *
1970
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
1962
1971
  */
1963
- plugins?: PluginsOptions;
1972
+ define?: Record<string, string>;
1973
+ /**
1974
+ * Enable source map generation.
1975
+ *
1976
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
1977
+ *
1978
+ * @default false
1979
+ *
1980
+ * @see {@link SourceMap}
1981
+ */
1982
+ sourcemap?: boolean;
1964
1983
  }
1965
1984
  interface TypeScriptOptions {
1966
1985
  jsxPragma?: string;
@@ -2198,7 +2217,7 @@ declare class BindingSourceMap {
2198
2217
  * Minimal wrapper around a `BundleHandle` for watcher events.
2199
2218
  * This is returned from watcher event data to allow calling `result.close()`.
2200
2219
  */
2201
- type BindingBuiltinPluginName = 'builtin:bundle-analyzer' | 'builtin:esm-external-require' | 'builtin:isolated-declaration' | 'builtin:replace' | 'builtin:vite-alias' | 'builtin:vite-build-import-analysis' | 'builtin:vite-dynamic-import-vars' | 'builtin:vite-import-glob' | 'builtin:vite-json' | 'builtin:vite-load-fallback' | 'builtin:vite-manifest' | 'builtin:vite-module-preload-polyfill' | 'builtin:vite-react-refresh-wrapper' | 'builtin:vite-reporter' | 'builtin:vite-resolve' | 'builtin:vite-transform' | 'builtin:vite-wasm-fallback' | 'builtin:vite-web-worker-post' | 'builtin:oxc-runtime';
2220
+ type BindingBuiltinPluginName = 'builtin:bundle-analyzer' | 'builtin:esm-external-require' | 'builtin:isolated-declaration' | 'builtin:replace' | 'builtin:vite-alias' | 'builtin:vite-build-import-analysis' | 'builtin:vite-dynamic-import-vars' | 'builtin:vite-import-glob' | 'builtin:vite-json' | 'builtin:vite-load-fallback' | 'builtin:vite-manifest' | 'builtin:vite-module-preload-polyfill' | 'builtin:vite-react-refresh-wrapper' | 'builtin:vite-reporter' | 'builtin:vite-resolve' | 'builtin:vite-transform' | 'builtin:vite-web-worker-post' | 'builtin:oxc-runtime';
2202
2221
  interface BindingHookResolveIdExtraArgs {
2203
2222
  custom?: number;
2204
2223
  isEntry: boolean;
@@ -2354,7 +2373,7 @@ declare class Exclude$1 {
2354
2373
  constructor(expr: FilterExpression);
2355
2374
  }
2356
2375
  //#endregion
2357
- //#region ../../node_modules/.pnpm/rolldown@1.1.0/node_modules/rolldown/dist/shared/define-config-GlCPZt1X.d.mts
2376
+ //#region ../../node_modules/.pnpm/rolldown@1.1.4/node_modules/rolldown/dist/shared/define-config-BBz954-q.d.mts
2358
2377
  //#region src/types/misc.d.ts
2359
2378
  /** @inline */
2360
2379
  type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
@@ -5792,7 +5811,7 @@ interface InputOptions {
5792
5811
  * describing your use case so we can address it before the option is gone.
5793
5812
  *
5794
5813
  * @see {@link https://rolldown.rs/in-depth/lazy-barrel-optimization | Lazy Barrel Documentation}
5795
- * @default true
5814
+ * @default false
5796
5815
  */
5797
5816
  lazyBarrel?: boolean;
5798
5817
  };
package/dist/index.d.ts CHANGED
@@ -423,8 +423,11 @@ interface Dependency {
423
423
  }
424
424
  interface Issue {
425
425
  type: string;
426
- data: unknown;
426
+ severity: IssueSeverity;
427
+ message: string;
428
+ data?: unknown;
427
429
  }
430
+ type IssueSeverity = "info" | "warning" | "error";
428
431
  /**
429
432
  * All types of resources.
430
433
  */
@@ -480,4 +483,4 @@ declare function normalizePath(pathToNormalize: string): string;
480
483
  */
481
484
  declare function getTypeByName(name: string): FileType;
482
485
  //#endregion
483
- export { type AssetResource, type ChunkResource, Config, type Connection, type ConnectionKind, type DecodedReportSourceMap, type Dependency, type FileType, type FilesystemResource, type Integration, type IntegrationOptions, type Issue, type JsonReport, type Metadata, type ModuleFormat, Report, type Resource, type ResourceBase, type ResourceKind, type Sizes, SondaEsbuildPlugin, SondaRollupPlugin, SondaVitePlugin, SondaWebpackPlugin, type SourceMap, type SourcemapResource, type UserOptions, getTypeByName, normalizePath, processEsbuildMetafile };
486
+ export { type AssetResource, type ChunkResource, Config, type Connection, type ConnectionKind, type DecodedReportSourceMap, type Dependency, type FileType, type FilesystemResource, type Integration, type IntegrationOptions, type Issue, type IssueSeverity, type JsonReport, type Metadata, type ModuleFormat, Report, type Resource, type ResourceBase, type ResourceKind, type Sizes, SondaEsbuildPlugin, SondaRollupPlugin, SondaVitePlugin, SondaWebpackPlugin, type SourceMap, type SourcemapResource, type UserOptions, getTypeByName, normalizePath, processEsbuildMetafile };