@afterpack/integration-utils 0.2.1 → 0.2.3

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.d.cts CHANGED
@@ -56,6 +56,9 @@ interface ConfigKeyDef {
56
56
  readonly namedValuesOf?: string;
57
57
  }
58
58
  declare const PRESET_VALUES: readonly ["minify", "light", "medium", "hard", "extreme"];
59
+ declare const SOURCE_TYPE_VALUES: readonly ["auto", "module", "script"];
60
+ type SourceType = (typeof SOURCE_TYPE_VALUES)[number];
61
+ declare function sourceTypeForOutputFormat(format: string | null | undefined): SourceType | undefined;
59
62
  declare const TRANSFORM_KIND_VALUES: readonly ["stringEncoding", "controlFlowFlatten", "opaquePredicate", "mixedBooleanArithmetic", "integerBytecode", "crossDependency", "scopeDeepen", "comparisonHardening", "selfIntegrity", "objectConstruction"];
60
63
  declare const REFLECTION_ALLOW_VALUES: readonly ["functionToString", "nameIntrospection", "argumentsCallee", "prototypeChain", "decoratorMetadata", "constructorIntrospection", "angular", "nestjs"];
61
64
  declare const BUILD_MODE_VALUES: readonly ["production", "development"];
@@ -81,6 +84,17 @@ declare const CONFIG_KEYS: readonly [{
81
84
  readonly values: readonly ["minify", "light", "medium", "hard", "extreme"];
82
85
  };
83
86
  readonly default: "light";
87
+ }, {
88
+ readonly path: "sourceType";
89
+ readonly shape: "scalar";
90
+ readonly scope: "program";
91
+ readonly tier: "free";
92
+ readonly surface: "engine";
93
+ readonly item: {
94
+ readonly kind: "enum";
95
+ readonly values: readonly ["auto", "module", "script"];
96
+ };
97
+ readonly default: "auto";
84
98
  }, {
85
99
  readonly path: "complexity";
86
100
  readonly shape: "scalar";
@@ -445,16 +459,6 @@ declare const CONFIG_KEYS: readonly [{
445
459
  readonly kind: "boolean";
446
460
  };
447
461
  readonly default: "true";
448
- }, {
449
- readonly path: "allowUnobfuscated";
450
- readonly shape: "scalar";
451
- readonly scope: "program";
452
- readonly tier: "free";
453
- readonly surface: "build";
454
- readonly item: {
455
- readonly kind: "boolean";
456
- };
457
- readonly default: "false";
458
462
  }, {
459
463
  readonly path: "key";
460
464
  readonly shape: "scalar";
@@ -507,6 +511,7 @@ type ReflectionAllow = (typeof REFLECTION_ALLOW_VALUES)[number];
507
511
  interface CoreConfigSubset {
508
512
  seed?: number | string;
509
513
  preset?: Preset;
514
+ sourceType?: SourceType;
510
515
  complexity?: number;
511
516
  inflation?: {
512
517
  max?: number | "unlimited";
@@ -591,7 +596,6 @@ interface AfterpackArtifactOptions {
591
596
  backup?: boolean;
592
597
  mode?: BuildMode;
593
598
  };
594
- allowUnobfuscated?: boolean;
595
599
  telemetry?: {
596
600
  enabled?: boolean;
597
601
  };
@@ -636,6 +640,7 @@ interface BuildEngineConfigOptions {
636
640
  policy: ReportPolicy;
637
641
  preset?: Preset;
638
642
  complexity?: number;
643
+ sourceType?: SourceType;
639
644
  seed?: number | string;
640
645
  sourcesContent?: boolean;
641
646
  regions?: RegionConfig[];
@@ -960,7 +965,7 @@ interface EngineFileResult {
960
965
  protectionMap?: ProtectionMap;
961
966
  status: "success" | "failure";
962
967
  error?: string;
963
- unobfuscated: boolean;
968
+ unobfuscated?: boolean;
964
969
  diagnostics?: EngineDiagnostic[];
965
970
  }
966
971
  interface EngineBatchResult {
@@ -1012,6 +1017,7 @@ interface ObfuscationPassOptions {
1012
1017
  buildLeg?: string;
1013
1018
  preset?: Preset;
1014
1019
  complexity?: number;
1020
+ sourceType?: SourceType;
1015
1021
  regions?: RegionConfig[];
1016
1022
  engineConfig?: CoreConfigSubset;
1017
1023
  directivesEnabled?: boolean;
@@ -1074,6 +1080,7 @@ interface BundleJs {
1074
1080
  entries: Map<string, BundleEntryLike>;
1075
1081
  }
1076
1082
  declare function collectBundleJs(bundle: OutputBundleLike, outDir: string): BundleJs;
1083
+ declare function sourceTypeForBundle(format: string | null | undefined, entries: Iterable<BundleEntryLike>): SourceType | undefined;
1077
1084
  declare function applyBundleOutput(bundle: OutputBundleLike, entry: BundleEntryLike, out: InMemoryOutput, policy: ReportPolicy): void;
1078
1085
  declare function stripBundleCssSourceMaps(bundle: OutputBundleLike): void;
1079
1086
  //#endregion
@@ -1148,4 +1155,4 @@ declare function extractSourceMappingURL(code: string): string | null;
1148
1155
  declare function decodeDataUri(url: string): string | null;
1149
1156
  declare function discoverInputSourceMap(jsPath: string, code?: string): string | null;
1150
1157
  //#endregion
1151
- export { type AfterpackArtifactOptions, type AfterpackConfig, type AfterpackPluginOptions, AlreadyObfuscatedError, type ArtifactMode, type BuildContext, type BuildEngineConfigOptions, type BundleEntryLike, type BundleJs, CLOUD_REFUSAL_SUMMARY, CONFIG_FILE_NAME, CONFIG_KEYS, CORE_FLOOR_SUMMARY, type CapturedDirective, type CapturedModule, type CliParseResult, type ClientIdentity, CloudApiError, type CloudErrorKind, type CloudNotice, type CollectJsOptions, type CombinedProtectionMapTarget, type ConfigIssue, type ConfigKeyDef, type ConfigScope, type ConfigSurface, type ConfigTier, type CoreConfig, type CoreConfigSubset, CoreVersionError, DIAG_ALREADY_OBFUSCATED, DIAG_RECEIPT_UNREADABLE, type DiagnosticsSummary, type DiagnosticsVerbosity, type DirectiveDiagnostic, type DirectiveManifest, type EngineBatchResult, type EngineDiagnostic, type EngineDiagnosticData, type EngineFileInput, type EngineFileResult, type EngineSeverity, type EngineSpan, type EnvLike, type EnvParseResult, type GitBuildContext, type GlobReserved, type InMemoryInput, type InMemoryOutput, type LoadedConfigFile, type Logger, type NormalizedPluginOptions, type NoticeLogger, type NoticeSeverity, type ObfuscationEngine, type ObfuscationPassOptions, type ObfuscationPassResult, type OutputBundleLike, PROTECTION_RECEIPT_FILE, type PassMessages, type PassReceiptIdentity, type PassSettings, type PassTiming, type PluginConfigInput, type PluginOptionsView, type Preset, type ProtectionReceipt, type ProtectionReceiptFile, type ProtectionVerification, type RegionConfig, type ReportPolicy, type ReportPolicySignals, type ResolvedPluginConfig, SEED_ENV_VAR, type SafeNotice, type SeedOption, type SeedOrigin, type TelemetryContext, type TelemetryDiagnostic, type TelemetryDiagnosticData, type TelemetryFacts, type TelemetryPayload, type TelemetryReporter, type TelemetryReporterDeps, type TelemetrySeverity, type TelemetrySpan, type TransformKind, UnreadableReceiptError, type ValidationResult, type ValueShape, type ValueType, type WriteArtifactsInput, type WriteArtifactsResult, type WriteProtectionReceiptInput, applyBundleOutput, applyResolvedKey, collectBundleJs, collectJsFiles, collectSourceMaps, collectStylesheets, createTelemetryReporter, decodeDataUri, discoverInputSourceMap, ensureAfterpackGitignore, extractSourceMappingURL, findUpward, getPath, installedRequiredLine, loadConfigFile, mergeConfig, normalizePluginOptions, npxAlternative, parseCliOptions, parseEnvOptions, passSettings, resolveClientIdentity, resolvePluginConfig, resolveReportPolicy, runObfuscationPass, sanitizeNotices, scanDirectives, serverAddsInfo, sha256Of, stripBundleCssSourceMaps, toEngineConfig, toPluginOptions, validateConfig, verifyProtectionReceipt, withSourceMappingURL, withoutCssSourceMappingURL, writeArtifacts, writeDeferredProtectionReceipt, writeProtectionReceipt };
1158
+ export { type AfterpackArtifactOptions, type AfterpackConfig, type AfterpackPluginOptions, AlreadyObfuscatedError, type ArtifactMode, type BuildContext, type BuildEngineConfigOptions, type BundleEntryLike, type BundleJs, CLOUD_REFUSAL_SUMMARY, CONFIG_FILE_NAME, CONFIG_KEYS, CORE_FLOOR_SUMMARY, type CapturedDirective, type CapturedModule, type CliParseResult, type ClientIdentity, CloudApiError, type CloudErrorKind, type CloudNotice, type CollectJsOptions, type CombinedProtectionMapTarget, type ConfigIssue, type ConfigKeyDef, type ConfigScope, type ConfigSurface, type ConfigTier, type CoreConfig, type CoreConfigSubset, CoreVersionError, DIAG_ALREADY_OBFUSCATED, DIAG_RECEIPT_UNREADABLE, type DiagnosticsSummary, type DiagnosticsVerbosity, type DirectiveDiagnostic, type DirectiveManifest, type EngineBatchResult, type EngineDiagnostic, type EngineDiagnosticData, type EngineFileInput, type EngineFileResult, type EngineSeverity, type EngineSpan, type EnvLike, type EnvParseResult, type GitBuildContext, type GlobReserved, type InMemoryInput, type InMemoryOutput, type LoadedConfigFile, type Logger, type NormalizedPluginOptions, type NoticeLogger, type NoticeSeverity, type ObfuscationEngine, type ObfuscationPassOptions, type ObfuscationPassResult, type OutputBundleLike, PROTECTION_RECEIPT_FILE, type PassMessages, type PassReceiptIdentity, type PassSettings, type PassTiming, type PluginConfigInput, type PluginOptionsView, type Preset, type ProtectionReceipt, type ProtectionReceiptFile, type ProtectionVerification, type RegionConfig, type ReportPolicy, type ReportPolicySignals, type ResolvedPluginConfig, SEED_ENV_VAR, type SafeNotice, type SeedOption, type SeedOrigin, type SourceType, type TelemetryContext, type TelemetryDiagnostic, type TelemetryDiagnosticData, type TelemetryFacts, type TelemetryPayload, type TelemetryReporter, type TelemetryReporterDeps, type TelemetrySeverity, type TelemetrySpan, type TransformKind, UnreadableReceiptError, type ValidationResult, type ValueShape, type ValueType, type WriteArtifactsInput, type WriteArtifactsResult, type WriteProtectionReceiptInput, applyBundleOutput, applyResolvedKey, collectBundleJs, collectJsFiles, collectSourceMaps, collectStylesheets, createTelemetryReporter, decodeDataUri, discoverInputSourceMap, ensureAfterpackGitignore, extractSourceMappingURL, findUpward, getPath, installedRequiredLine, loadConfigFile, mergeConfig, normalizePluginOptions, npxAlternative, parseCliOptions, parseEnvOptions, passSettings, resolveClientIdentity, resolvePluginConfig, resolveReportPolicy, runObfuscationPass, sanitizeNotices, scanDirectives, serverAddsInfo, sha256Of, sourceTypeForBundle, sourceTypeForOutputFormat, stripBundleCssSourceMaps, toEngineConfig, toPluginOptions, validateConfig, verifyProtectionReceipt, withSourceMappingURL, withoutCssSourceMappingURL, writeArtifacts, writeDeferredProtectionReceipt, writeProtectionReceipt };
package/dist/index.d.ts CHANGED
@@ -56,6 +56,9 @@ interface ConfigKeyDef {
56
56
  readonly namedValuesOf?: string;
57
57
  }
58
58
  declare const PRESET_VALUES: readonly ["minify", "light", "medium", "hard", "extreme"];
59
+ declare const SOURCE_TYPE_VALUES: readonly ["auto", "module", "script"];
60
+ type SourceType = (typeof SOURCE_TYPE_VALUES)[number];
61
+ declare function sourceTypeForOutputFormat(format: string | null | undefined): SourceType | undefined;
59
62
  declare const TRANSFORM_KIND_VALUES: readonly ["stringEncoding", "controlFlowFlatten", "opaquePredicate", "mixedBooleanArithmetic", "integerBytecode", "crossDependency", "scopeDeepen", "comparisonHardening", "selfIntegrity", "objectConstruction"];
60
63
  declare const REFLECTION_ALLOW_VALUES: readonly ["functionToString", "nameIntrospection", "argumentsCallee", "prototypeChain", "decoratorMetadata", "constructorIntrospection", "angular", "nestjs"];
61
64
  declare const BUILD_MODE_VALUES: readonly ["production", "development"];
@@ -81,6 +84,17 @@ declare const CONFIG_KEYS: readonly [{
81
84
  readonly values: readonly ["minify", "light", "medium", "hard", "extreme"];
82
85
  };
83
86
  readonly default: "light";
87
+ }, {
88
+ readonly path: "sourceType";
89
+ readonly shape: "scalar";
90
+ readonly scope: "program";
91
+ readonly tier: "free";
92
+ readonly surface: "engine";
93
+ readonly item: {
94
+ readonly kind: "enum";
95
+ readonly values: readonly ["auto", "module", "script"];
96
+ };
97
+ readonly default: "auto";
84
98
  }, {
85
99
  readonly path: "complexity";
86
100
  readonly shape: "scalar";
@@ -445,16 +459,6 @@ declare const CONFIG_KEYS: readonly [{
445
459
  readonly kind: "boolean";
446
460
  };
447
461
  readonly default: "true";
448
- }, {
449
- readonly path: "allowUnobfuscated";
450
- readonly shape: "scalar";
451
- readonly scope: "program";
452
- readonly tier: "free";
453
- readonly surface: "build";
454
- readonly item: {
455
- readonly kind: "boolean";
456
- };
457
- readonly default: "false";
458
462
  }, {
459
463
  readonly path: "key";
460
464
  readonly shape: "scalar";
@@ -507,6 +511,7 @@ type ReflectionAllow = (typeof REFLECTION_ALLOW_VALUES)[number];
507
511
  interface CoreConfigSubset {
508
512
  seed?: number | string;
509
513
  preset?: Preset;
514
+ sourceType?: SourceType;
510
515
  complexity?: number;
511
516
  inflation?: {
512
517
  max?: number | "unlimited";
@@ -591,7 +596,6 @@ interface AfterpackArtifactOptions {
591
596
  backup?: boolean;
592
597
  mode?: BuildMode;
593
598
  };
594
- allowUnobfuscated?: boolean;
595
599
  telemetry?: {
596
600
  enabled?: boolean;
597
601
  };
@@ -636,6 +640,7 @@ interface BuildEngineConfigOptions {
636
640
  policy: ReportPolicy;
637
641
  preset?: Preset;
638
642
  complexity?: number;
643
+ sourceType?: SourceType;
639
644
  seed?: number | string;
640
645
  sourcesContent?: boolean;
641
646
  regions?: RegionConfig[];
@@ -960,7 +965,7 @@ interface EngineFileResult {
960
965
  protectionMap?: ProtectionMap;
961
966
  status: "success" | "failure";
962
967
  error?: string;
963
- unobfuscated: boolean;
968
+ unobfuscated?: boolean;
964
969
  diagnostics?: EngineDiagnostic[];
965
970
  }
966
971
  interface EngineBatchResult {
@@ -1012,6 +1017,7 @@ interface ObfuscationPassOptions {
1012
1017
  buildLeg?: string;
1013
1018
  preset?: Preset;
1014
1019
  complexity?: number;
1020
+ sourceType?: SourceType;
1015
1021
  regions?: RegionConfig[];
1016
1022
  engineConfig?: CoreConfigSubset;
1017
1023
  directivesEnabled?: boolean;
@@ -1074,6 +1080,7 @@ interface BundleJs {
1074
1080
  entries: Map<string, BundleEntryLike>;
1075
1081
  }
1076
1082
  declare function collectBundleJs(bundle: OutputBundleLike, outDir: string): BundleJs;
1083
+ declare function sourceTypeForBundle(format: string | null | undefined, entries: Iterable<BundleEntryLike>): SourceType | undefined;
1077
1084
  declare function applyBundleOutput(bundle: OutputBundleLike, entry: BundleEntryLike, out: InMemoryOutput, policy: ReportPolicy): void;
1078
1085
  declare function stripBundleCssSourceMaps(bundle: OutputBundleLike): void;
1079
1086
  //#endregion
@@ -1148,4 +1155,4 @@ declare function extractSourceMappingURL(code: string): string | null;
1148
1155
  declare function decodeDataUri(url: string): string | null;
1149
1156
  declare function discoverInputSourceMap(jsPath: string, code?: string): string | null;
1150
1157
  //#endregion
1151
- export { type AfterpackArtifactOptions, type AfterpackConfig, type AfterpackPluginOptions, AlreadyObfuscatedError, type ArtifactMode, type BuildContext, type BuildEngineConfigOptions, type BundleEntryLike, type BundleJs, CLOUD_REFUSAL_SUMMARY, CONFIG_FILE_NAME, CONFIG_KEYS, CORE_FLOOR_SUMMARY, type CapturedDirective, type CapturedModule, type CliParseResult, type ClientIdentity, CloudApiError, type CloudErrorKind, type CloudNotice, type CollectJsOptions, type CombinedProtectionMapTarget, type ConfigIssue, type ConfigKeyDef, type ConfigScope, type ConfigSurface, type ConfigTier, type CoreConfig, type CoreConfigSubset, CoreVersionError, DIAG_ALREADY_OBFUSCATED, DIAG_RECEIPT_UNREADABLE, type DiagnosticsSummary, type DiagnosticsVerbosity, type DirectiveDiagnostic, type DirectiveManifest, type EngineBatchResult, type EngineDiagnostic, type EngineDiagnosticData, type EngineFileInput, type EngineFileResult, type EngineSeverity, type EngineSpan, type EnvLike, type EnvParseResult, type GitBuildContext, type GlobReserved, type InMemoryInput, type InMemoryOutput, type LoadedConfigFile, type Logger, type NormalizedPluginOptions, type NoticeLogger, type NoticeSeverity, type ObfuscationEngine, type ObfuscationPassOptions, type ObfuscationPassResult, type OutputBundleLike, PROTECTION_RECEIPT_FILE, type PassMessages, type PassReceiptIdentity, type PassSettings, type PassTiming, type PluginConfigInput, type PluginOptionsView, type Preset, type ProtectionReceipt, type ProtectionReceiptFile, type ProtectionVerification, type RegionConfig, type ReportPolicy, type ReportPolicySignals, type ResolvedPluginConfig, SEED_ENV_VAR, type SafeNotice, type SeedOption, type SeedOrigin, type TelemetryContext, type TelemetryDiagnostic, type TelemetryDiagnosticData, type TelemetryFacts, type TelemetryPayload, type TelemetryReporter, type TelemetryReporterDeps, type TelemetrySeverity, type TelemetrySpan, type TransformKind, UnreadableReceiptError, type ValidationResult, type ValueShape, type ValueType, type WriteArtifactsInput, type WriteArtifactsResult, type WriteProtectionReceiptInput, applyBundleOutput, applyResolvedKey, collectBundleJs, collectJsFiles, collectSourceMaps, collectStylesheets, createTelemetryReporter, decodeDataUri, discoverInputSourceMap, ensureAfterpackGitignore, extractSourceMappingURL, findUpward, getPath, installedRequiredLine, loadConfigFile, mergeConfig, normalizePluginOptions, npxAlternative, parseCliOptions, parseEnvOptions, passSettings, resolveClientIdentity, resolvePluginConfig, resolveReportPolicy, runObfuscationPass, sanitizeNotices, scanDirectives, serverAddsInfo, sha256Of, stripBundleCssSourceMaps, toEngineConfig, toPluginOptions, validateConfig, verifyProtectionReceipt, withSourceMappingURL, withoutCssSourceMappingURL, writeArtifacts, writeDeferredProtectionReceipt, writeProtectionReceipt };
1158
+ export { type AfterpackArtifactOptions, type AfterpackConfig, type AfterpackPluginOptions, AlreadyObfuscatedError, type ArtifactMode, type BuildContext, type BuildEngineConfigOptions, type BundleEntryLike, type BundleJs, CLOUD_REFUSAL_SUMMARY, CONFIG_FILE_NAME, CONFIG_KEYS, CORE_FLOOR_SUMMARY, type CapturedDirective, type CapturedModule, type CliParseResult, type ClientIdentity, CloudApiError, type CloudErrorKind, type CloudNotice, type CollectJsOptions, type CombinedProtectionMapTarget, type ConfigIssue, type ConfigKeyDef, type ConfigScope, type ConfigSurface, type ConfigTier, type CoreConfig, type CoreConfigSubset, CoreVersionError, DIAG_ALREADY_OBFUSCATED, DIAG_RECEIPT_UNREADABLE, type DiagnosticsSummary, type DiagnosticsVerbosity, type DirectiveDiagnostic, type DirectiveManifest, type EngineBatchResult, type EngineDiagnostic, type EngineDiagnosticData, type EngineFileInput, type EngineFileResult, type EngineSeverity, type EngineSpan, type EnvLike, type EnvParseResult, type GitBuildContext, type GlobReserved, type InMemoryInput, type InMemoryOutput, type LoadedConfigFile, type Logger, type NormalizedPluginOptions, type NoticeLogger, type NoticeSeverity, type ObfuscationEngine, type ObfuscationPassOptions, type ObfuscationPassResult, type OutputBundleLike, PROTECTION_RECEIPT_FILE, type PassMessages, type PassReceiptIdentity, type PassSettings, type PassTiming, type PluginConfigInput, type PluginOptionsView, type Preset, type ProtectionReceipt, type ProtectionReceiptFile, type ProtectionVerification, type RegionConfig, type ReportPolicy, type ReportPolicySignals, type ResolvedPluginConfig, SEED_ENV_VAR, type SafeNotice, type SeedOption, type SeedOrigin, type SourceType, type TelemetryContext, type TelemetryDiagnostic, type TelemetryDiagnosticData, type TelemetryFacts, type TelemetryPayload, type TelemetryReporter, type TelemetryReporterDeps, type TelemetrySeverity, type TelemetrySpan, type TransformKind, UnreadableReceiptError, type ValidationResult, type ValueShape, type ValueType, type WriteArtifactsInput, type WriteArtifactsResult, type WriteProtectionReceiptInput, applyBundleOutput, applyResolvedKey, collectBundleJs, collectJsFiles, collectSourceMaps, collectStylesheets, createTelemetryReporter, decodeDataUri, discoverInputSourceMap, ensureAfterpackGitignore, extractSourceMappingURL, findUpward, getPath, installedRequiredLine, loadConfigFile, mergeConfig, normalizePluginOptions, npxAlternative, parseCliOptions, parseEnvOptions, passSettings, resolveClientIdentity, resolvePluginConfig, resolveReportPolicy, runObfuscationPass, sanitizeNotices, scanDirectives, serverAddsInfo, sha256Of, sourceTypeForBundle, sourceTypeForOutputFormat, stripBundleCssSourceMaps, toEngineConfig, toPluginOptions, validateConfig, verifyProtectionReceipt, withSourceMappingURL, withoutCssSourceMappingURL, writeArtifacts, writeDeferredProtectionReceipt, writeProtectionReceipt };