@afterpack/integration-utils 0.2.0 → 0.2.2

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";
@@ -260,7 +274,7 @@ declare const CONFIG_KEYS: readonly [{
260
274
  readonly item: {
261
275
  readonly kind: "boolean";
262
276
  };
263
- readonly default: "true when the bundler emitted a source map";
277
+ readonly default: "true when the bundler emitted a source map, outside CI";
264
278
  }, {
265
279
  readonly path: "protectionMap.detailed";
266
280
  readonly shape: "scalar";
@@ -507,6 +521,7 @@ type ReflectionAllow = (typeof REFLECTION_ALLOW_VALUES)[number];
507
521
  interface CoreConfigSubset {
508
522
  seed?: number | string;
509
523
  preset?: Preset;
524
+ sourceType?: SourceType;
510
525
  complexity?: number;
511
526
  inflation?: {
512
527
  max?: number | "unlimited";
@@ -636,6 +651,7 @@ interface BuildEngineConfigOptions {
636
651
  policy: ReportPolicy;
637
652
  preset?: Preset;
638
653
  complexity?: number;
654
+ sourceType?: SourceType;
639
655
  seed?: number | string;
640
656
  sourcesContent?: boolean;
641
657
  regions?: RegionConfig[];
@@ -1012,6 +1028,7 @@ interface ObfuscationPassOptions {
1012
1028
  buildLeg?: string;
1013
1029
  preset?: Preset;
1014
1030
  complexity?: number;
1031
+ sourceType?: SourceType;
1015
1032
  regions?: RegionConfig[];
1016
1033
  engineConfig?: CoreConfigSubset;
1017
1034
  directivesEnabled?: boolean;
@@ -1074,7 +1091,9 @@ interface BundleJs {
1074
1091
  entries: Map<string, BundleEntryLike>;
1075
1092
  }
1076
1093
  declare function collectBundleJs(bundle: OutputBundleLike, outDir: string): BundleJs;
1094
+ declare function sourceTypeForBundle(format: string | null | undefined, entries: Iterable<BundleEntryLike>): SourceType | undefined;
1077
1095
  declare function applyBundleOutput(bundle: OutputBundleLike, entry: BundleEntryLike, out: InMemoryOutput, policy: ReportPolicy): void;
1096
+ declare function stripBundleCssSourceMaps(bundle: OutputBundleLike): void;
1078
1097
  //#endregion
1079
1098
  //#region src/collect.d.ts
1080
1099
  interface CollectJsOptions {
@@ -1083,6 +1102,7 @@ interface CollectJsOptions {
1083
1102
  }
1084
1103
  declare function collectJsFiles(target: string, options?: CollectJsOptions): string[];
1085
1104
  declare function collectSourceMaps(dir: string): string[];
1105
+ declare function collectStylesheets(dir: string): string[];
1086
1106
  //#endregion
1087
1107
  //#region src/config-file.d.ts
1088
1108
  declare const CONFIG_FILE_NAME = "afterpack.json";
@@ -1141,8 +1161,9 @@ declare function resolvePluginConfig(input: PluginConfigInput): ResolvedPluginCo
1141
1161
  //#endregion
1142
1162
  //#region src/source-map.d.ts
1143
1163
  declare function withSourceMappingURL(code: string, url: string | null): string;
1164
+ declare function withoutCssSourceMappingURL(css: string): string;
1144
1165
  declare function extractSourceMappingURL(code: string): string | null;
1145
1166
  declare function decodeDataUri(url: string): string | null;
1146
1167
  declare function discoverInputSourceMap(jsPath: string, code?: string): string | null;
1147
1168
  //#endregion
1148
- 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, createTelemetryReporter, decodeDataUri, discoverInputSourceMap, ensureAfterpackGitignore, extractSourceMappingURL, findUpward, getPath, installedRequiredLine, loadConfigFile, mergeConfig, normalizePluginOptions, npxAlternative, parseCliOptions, parseEnvOptions, passSettings, resolveClientIdentity, resolvePluginConfig, resolveReportPolicy, runObfuscationPass, sanitizeNotices, scanDirectives, serverAddsInfo, sha256Of, toEngineConfig, toPluginOptions, validateConfig, verifyProtectionReceipt, withSourceMappingURL, writeArtifacts, writeDeferredProtectionReceipt, writeProtectionReceipt };
1169
+ 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";
@@ -260,7 +274,7 @@ declare const CONFIG_KEYS: readonly [{
260
274
  readonly item: {
261
275
  readonly kind: "boolean";
262
276
  };
263
- readonly default: "true when the bundler emitted a source map";
277
+ readonly default: "true when the bundler emitted a source map, outside CI";
264
278
  }, {
265
279
  readonly path: "protectionMap.detailed";
266
280
  readonly shape: "scalar";
@@ -507,6 +521,7 @@ type ReflectionAllow = (typeof REFLECTION_ALLOW_VALUES)[number];
507
521
  interface CoreConfigSubset {
508
522
  seed?: number | string;
509
523
  preset?: Preset;
524
+ sourceType?: SourceType;
510
525
  complexity?: number;
511
526
  inflation?: {
512
527
  max?: number | "unlimited";
@@ -636,6 +651,7 @@ interface BuildEngineConfigOptions {
636
651
  policy: ReportPolicy;
637
652
  preset?: Preset;
638
653
  complexity?: number;
654
+ sourceType?: SourceType;
639
655
  seed?: number | string;
640
656
  sourcesContent?: boolean;
641
657
  regions?: RegionConfig[];
@@ -1012,6 +1028,7 @@ interface ObfuscationPassOptions {
1012
1028
  buildLeg?: string;
1013
1029
  preset?: Preset;
1014
1030
  complexity?: number;
1031
+ sourceType?: SourceType;
1015
1032
  regions?: RegionConfig[];
1016
1033
  engineConfig?: CoreConfigSubset;
1017
1034
  directivesEnabled?: boolean;
@@ -1074,7 +1091,9 @@ interface BundleJs {
1074
1091
  entries: Map<string, BundleEntryLike>;
1075
1092
  }
1076
1093
  declare function collectBundleJs(bundle: OutputBundleLike, outDir: string): BundleJs;
1094
+ declare function sourceTypeForBundle(format: string | null | undefined, entries: Iterable<BundleEntryLike>): SourceType | undefined;
1077
1095
  declare function applyBundleOutput(bundle: OutputBundleLike, entry: BundleEntryLike, out: InMemoryOutput, policy: ReportPolicy): void;
1096
+ declare function stripBundleCssSourceMaps(bundle: OutputBundleLike): void;
1078
1097
  //#endregion
1079
1098
  //#region src/collect.d.ts
1080
1099
  interface CollectJsOptions {
@@ -1083,6 +1102,7 @@ interface CollectJsOptions {
1083
1102
  }
1084
1103
  declare function collectJsFiles(target: string, options?: CollectJsOptions): string[];
1085
1104
  declare function collectSourceMaps(dir: string): string[];
1105
+ declare function collectStylesheets(dir: string): string[];
1086
1106
  //#endregion
1087
1107
  //#region src/config-file.d.ts
1088
1108
  declare const CONFIG_FILE_NAME = "afterpack.json";
@@ -1141,8 +1161,9 @@ declare function resolvePluginConfig(input: PluginConfigInput): ResolvedPluginCo
1141
1161
  //#endregion
1142
1162
  //#region src/source-map.d.ts
1143
1163
  declare function withSourceMappingURL(code: string, url: string | null): string;
1164
+ declare function withoutCssSourceMappingURL(css: string): string;
1144
1165
  declare function extractSourceMappingURL(code: string): string | null;
1145
1166
  declare function decodeDataUri(url: string): string | null;
1146
1167
  declare function discoverInputSourceMap(jsPath: string, code?: string): string | null;
1147
1168
  //#endregion
1148
- 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, createTelemetryReporter, decodeDataUri, discoverInputSourceMap, ensureAfterpackGitignore, extractSourceMappingURL, findUpward, getPath, installedRequiredLine, loadConfigFile, mergeConfig, normalizePluginOptions, npxAlternative, parseCliOptions, parseEnvOptions, passSettings, resolveClientIdentity, resolvePluginConfig, resolveReportPolicy, runObfuscationPass, sanitizeNotices, scanDirectives, serverAddsInfo, sha256Of, toEngineConfig, toPluginOptions, validateConfig, verifyProtectionReceipt, withSourceMappingURL, writeArtifacts, writeDeferredProtectionReceipt, writeProtectionReceipt };
1169
+ 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 };