Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-res

Package Overview
Dependencies
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-res - npm Package Compare versions

Comparing version 0.15.1 to 0.15.2

12

dist/cli.d.ts

@@ -1,7 +0,9 @@

import et from 'elementtree';
import type et from 'elementtree';
import type { NativeProjectConfigByPlatform, Options, PlatformOptions } from '.';
import { ResizeOptions } from './image';
import { NativeProjectConfig } from './native';
import { AdaptiveIconResourceOptions, Platform, RunPlatformOptions, SimpleResourceOptions } from './platform';
import { ResourceKey, ResourceType, Source } from './resources';
import type { ResizeOptions } from './image';
import type { NativeProjectConfig } from './native';
import type { AdaptiveIconResourceOptions, RunPlatformOptions, SimpleResourceOptions } from './platform';
import { Platform } from './platform';
import type { Source } from './resources';
import { ResourceKey, ResourceType } from './resources';
export declare const DEFAULT_RESOURCES_DIRECTORY = "resources";

@@ -8,0 +10,0 @@ export declare const DEFAULT_FIT = "cover";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultAdaptiveIconSources = exports.getDefaultSources = exports.parseSource = exports.parseSourceFromArgs = exports.parseAdaptiveIconSourceFromArgs = exports.parseSimpleResourceOptions = exports.parseAdaptiveIconBackgroundOptions = exports.parseAdaptiveIconForegroundOptions = exports.parseAdaptiveIconResourceOptions = exports.parseSkipConfigOption = exports.parseCopyOption = exports.generateNativeProjectConfig = exports.generateRunOptions = exports.generatePlatformProjectOptions = exports.generatePlatformOptions = exports.parsePlatformOption = exports.parseResizeOptions = exports.parseResourcesDirectoryOption = exports.parseOptions = exports.resolveOptions = exports.getDirectory = exports.DEFAULT_POSITION = exports.DEFAULT_FIT = exports.DEFAULT_RESOURCES_DIRECTORY = void 0;
const config_1 = require("./cordova/config");

@@ -4,0 +5,0 @@ const error_1 = require("./error");

/// <reference types="node" />
import et from 'elementtree';
import { Platform } from '../platform';
import { ResolvedColorSource, ResolvedSource, ResourceConfig, ResourceKey, ResourceType, ResourceValue, UnknownResource } from '../resources';
import type { ResolvedColorSource, ResolvedSource, ResourceConfig, ResourceValue, UnknownResource } from '../resources';
import { ResourceKey, ResourceType } from '../resources';
export declare function getConfigPath(directory: string): string;

@@ -40,3 +41,3 @@ export declare function run(resourcesDirectory: string, doc: et.ElementTree, sources: readonly ResolvedSource[], resources: readonly ResourceConfig[], errstream: NodeJS.WritableStream | null): Promise<void>;

};
export declare const sortResources: (a: UnknownResource, b: UnknownResource) => 0 | 1 | -1;
export declare const sortResources: (a: UnknownResource, b: UnknownResource) => -1 | 0 | 1;
export declare function getPlatformConfigXmlRules(platform: Platform): PlatformConfigXmlRules;

@@ -43,0 +44,0 @@ export interface ResourceConfigXmlIndex {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getResourceConfigXmlRules = exports.getPlatformConfigXmlRules = exports.sortResources = exports.RESOURCE_WEIGHTS = exports.pathValues = exports.getIndexAttributeXPathParts = exports.getResourceXPaths = exports.getAttributeType = exports.getPreference = exports.getPlatforms = exports.write = exports.read = exports.groupImages = exports.resolveAttribute = exports.resolveAttributeValue = exports.conformPath = exports.resolveElement = exports.resolvePlatformElement = exports.runResource = exports.runConfig = exports.runColorsConfig = exports.resolveColorsDocument = exports.run = exports.getConfigPath = void 0;
const tslib_1 = require("tslib");

@@ -4,0 +5,0 @@ const utils_fs_1 = require("@ionic/utils-fs");

@@ -1,2 +0,2 @@

import { ResourceType } from './resources';
import type { ResourceType } from './resources';
export declare const enum ValidationErrorCode {

@@ -44,3 +44,3 @@ BAD_IMAGE_FORMAT = "BAD_IMAGE_FORMAT",

toJSON(): {
details: ValidationErrorDetails;
[key: string]: any;
};

@@ -55,4 +55,4 @@ }

toJSON(): {
sourceErrors: readonly ValidationError[];
[key: string]: any;
};
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResolveSourceImageError = exports.ValidationError = exports.BadInputError = exports.BaseError = void 0;
class BaseError extends Error {

@@ -4,0 +5,0 @@ constructor(message) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = void 0;
const cli_1 = require("./cli");

@@ -4,0 +5,0 @@ const help = `

/// <reference types="node" />
import { Metadata, Sharp } from 'sharp';
import { Platform } from './platform';
import { Format, ResolvedImageSource, ResourceType } from './resources';
import type { Metadata, Sharp } from 'sharp';
import type { Platform } from './platform';
import type { ResolvedImageSource, ResourceType } from './resources';
import { Format } from './resources';
export declare type SharpTransformation = (pipeline: Sharp) => Promise<Sharp> | Sharp;

@@ -6,0 +7,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createImageConverter = exports.createImageResizer = exports.applyTransformations = exports.generateImage = exports.validatePosition = exports.validateFit = exports.POSITIONS = exports.FITS_WITH_POSITION = exports.FITS = exports.debugSourceImage = exports.readSourceImage = exports.resolveSourceImage = void 0;
const tslib_1 = require("tslib");

@@ -4,0 +5,0 @@ const utils_array_1 = require("@ionic/utils-array");

/// <reference types="node" />
import { ResizeOptions } from './image';
import { NativeProjectConfig } from './native';
import { Platform, RunPlatformOptions, TransformFunction } from './platform';
import { Density, Orientation, SourceType } from './resources';
import type { ResizeOptions } from './image';
import type { NativeProjectConfig } from './native';
import type { Platform, RunPlatformOptions, TransformFunction } from './platform';
import type { Density, Orientation } from './resources';
import { SourceType } from './resources';
interface Result {

@@ -7,0 +8,0 @@ resources: ResultResource[];

@@ -43,3 +43,3 @@ "use strict";

const shouldCopySplash = resources.findIndex(res => res.type === "splash" /* SPLASH */) !== -1;
await native_1.copyToNativeProject(platform, nativeProject, shouldCopyIcons, shouldCopySplash, logstream, errstream);
await native_1.copyToNativeProject(platform, resourcesDirectory, nativeProject, shouldCopyIcons, shouldCopySplash, logstream, errstream);
}

@@ -76,2 +76,3 @@ }

}
// eslint-disable-next-line @typescript-eslint/no-namespace
(function (CordovaRes) {

@@ -78,0 +79,0 @@ CordovaRes.run = CordovaRes;

@@ -20,2 +20,2 @@ /// <reference types="node" />

}
export declare function copyToNativeProject(platform: Platform, nativeProject: NativeProjectConfig, shouldCopyIcons: boolean, shouldCopySplash: boolean, logstream: NodeJS.WritableStream | null, errstream: NodeJS.WritableStream | null): Promise<void>;
export declare function copyToNativeProject(platform: Platform, resourcesDirectory: string, nativeProject: NativeProjectConfig, shouldCopyIcons: boolean, shouldCopySplash: boolean, logstream: NodeJS.WritableStream | null, errstream: NodeJS.WritableStream | null): Promise<void>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.copyToNativeProject = void 0;
const tslib_1 = require("tslib");

@@ -11,6 +12,6 @@ const utils_fs_1 = require("@ionic/utils-fs");

const debug = debug_1.default('cordova-res:native');
const SOURCE_IOS_ICON = 'resources/ios/icon';
const SOURCE_IOS_SPLASH = 'resources/ios/splash';
const SOURCE_ANDROID_ICON = 'resources/android/icon';
const SOURCE_ANDROID_SPLASH = 'resources/android/splash';
const SOURCE_IOS_ICON = 'ios/icon';
const SOURCE_IOS_SPLASH = 'ios/splash';
const SOURCE_ANDROID_ICON = 'android/icon';
const SOURCE_ANDROID_SPLASH = 'android/splash';
const IOS_APP_ICON_SET_NAME = 'AppIcon';

@@ -279,3 +280,3 @@ const IOS_APP_ICON_SET_PATH = `App/App/Assets.xcassets/${IOS_APP_ICON_SET_NAME}.appiconset`;

}
async function copyToNativeProject(platform, nativeProject, shouldCopyIcons, shouldCopySplash, logstream, errstream) {
async function copyToNativeProject(platform, resourcesDirectory, nativeProject, shouldCopyIcons, shouldCopySplash, logstream, errstream) {
let count = 0;

@@ -285,6 +286,6 @@ if (platform === "ios" /* IOS */) {

if (shouldCopyIcons) {
count += await copyImages(SOURCE_IOS_ICON, path_1.default.join(iosProjectDirectory, IOS_APP_ICON_SET_PATH), IOS_ICONS, errstream);
count += await copyImages(path_1.default.join(resourcesDirectory, SOURCE_IOS_ICON), path_1.default.join(iosProjectDirectory, IOS_APP_ICON_SET_PATH), IOS_ICONS, errstream);
}
if (shouldCopySplash) {
count += await copyImages(SOURCE_IOS_SPLASH, path_1.default.join(iosProjectDirectory, IOS_SPLASH_IMAGE_SET_PATH), IOS_SPLASHES, errstream);
count += await copyImages(path_1.default.join(resourcesDirectory, SOURCE_IOS_SPLASH), path_1.default.join(iosProjectDirectory, IOS_SPLASH_IMAGE_SET_PATH), IOS_SPLASHES, errstream);
}

@@ -295,10 +296,10 @@ }

if (shouldCopyIcons) {
count += await copyImages(SOURCE_ANDROID_ICON, path_1.default.join(androidProjectDirectory, ANDROID_RES_PATH), ANDROID_ICONS, errstream);
count += await copyImages(path_1.default.join(resourcesDirectory, SOURCE_ANDROID_ICON), path_1.default.join(androidProjectDirectory, ANDROID_RES_PATH), ANDROID_ICONS, errstream);
}
if (shouldCopySplash) {
count += await copyImages(SOURCE_ANDROID_SPLASH, path_1.default.join(androidProjectDirectory, ANDROID_RES_PATH), ANDROID_SPLASHES, errstream);
count += await copyImages(path_1.default.join(resourcesDirectory, SOURCE_ANDROID_SPLASH), path_1.default.join(androidProjectDirectory, ANDROID_RES_PATH), ANDROID_SPLASHES, errstream);
}
}
else {
errstream === null || errstream === void 0 ? void 0 : errstream.write(util_1.default.format('WARN:\tCopying to native projects is not supported for %s', platform_1.prettyPlatform(platform)) + '\n');
errstream === null || errstream === void 0 ? void 0 : errstream.write(util_1.default.format('WARN:\tCopying to native projects is not supported for the %s platform', platform_1.prettyPlatform(platform)) + '\n');
return;

@@ -305,0 +306,0 @@ }

/// <reference types="node" />
import { Sharp } from 'sharp';
import { ImageSchema } from './image';
import { AndroidAdaptiveIconResourceConfig, ColorSource, Format, ImageSource, ImageSourceData, ResolvedImageSource, ResolvedSource, ResourceConfig, ResourceKey, ResourceType, SimpleResourceConfig } from './resources';
import type { Sharp } from 'sharp';
import type { Operations } from '.';
import type { ImageSchema } from './image';
import type { AndroidAdaptiveIconResourceConfig, ColorSource, Format, ImageSource, ImageSourceData, ResolvedImageSource, ResolvedSource, ResourceConfig, SimpleResourceConfig } from './resources';
import { ResourceKey, ResourceType } from './resources';
export declare const enum Platform {

@@ -7,0 +8,0 @@ ANDROID = "android",

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.prettyPlatform = exports.isSupportedPlatform = exports.filterSupportedPlatforms = exports.validatePlatforms = exports.resolveSource = exports.imageSourceToPath = exports.generateImageResource = exports.getResourceDestination = exports.generateAdaptiveIconResourcesPortionFromImageSource = exports.generateAdaptiveIconResourcesPortion = exports.consolidateAdaptiveIconResources = exports.generateAdaptiveIconResources = exports.safelyGenerateAdaptiveIconResources = exports.combineTransformFunctions = exports.getResourceTransformFunction = exports.generateSimpleResources = exports.safelyGenerateSimpleResources = exports.run = exports.PLATFORMS = void 0;
const tslib_1 = require("tslib");

@@ -4,0 +5,0 @@ const utils_fs_1 = require("@ionic/utils-fs");

@@ -1,3 +0,5 @@

import * as et from 'elementtree';
import { Platform } from './platform';
import type * as et from 'elementtree';
import type { Platform } from './platform';
export interface PackageJson {

@@ -4,0 +6,0 @@ readonly name: string;

/// <reference types="node" />
import { Metadata, Sharp } from 'sharp';
import type { Metadata, Sharp } from 'sharp';
import { Platform } from './platform';

@@ -4,0 +4,0 @@ export declare const enum ResourceType {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IOS_SPLASH_RESOURCES = exports.IOS_2X_UNIVERSAL_ANYANY_SPLASH = exports.IOS_IPHONE_SPLASH = exports.IOS_2X_IPHONE_SPLASH = exports.IOS_PORTRAIT_IPAD_SPLASH = exports.IOS_PORTRAIT_IPADPRO_SPLASH = exports.IOS_PORTRAIT_2X_IPAD_SPLASH = exports.IOS_LANDSCAPE_IPAD_SPLASH = exports.IOS_LANDSCAPE_IPADPRO_SPLASH = exports.IOS_LANDSCAPE_2X_IPAD_SPLASH = exports.IOS_736H_LANDSCAPE_SPLASH = exports.IOS_736H_SPLASH = exports.IOS_2436H_LANDSCAPE_SPLASH = exports.IOS_2436H_SPLASH = exports.IOS_1792H_LANDSCAPE_IPHONE_SPLASH = exports.IOS_1792H_IPHONE_SPLASH = exports.IOS_2688H_LANDSCAPE_IPHONE_SPLASH = exports.IOS_2688H_IPHONE_SPLASH = exports.IOS_667H_SPLASH = exports.IOS_568H_2X_IPHONE_SPLASH = exports.IOS_ICON_RESOURCES = exports.IOS_108_PT_2X_ICON = exports.IOS_98_PT_2X_ICON = exports.IOS_86_PT_2X_ICON = exports.IOS_44_PT_2X_ICON = exports.IOS_27_5_PT_ICON = exports.IOS_24_PT_ICON = exports.IOS_1024_ICON = exports.IOS_83_5_PT_2X_ICON = exports.IOS_76_PT_2X_ICON = exports.IOS_76_PT_ICON = exports.IOS_72_PT_2X_ICON = exports.IOS_72_PT_ICON = exports.IOS_60_PT_3X_ICON = exports.IOS_60_PT_2X_ICON = exports.IOS_60_PT_ICON = exports.IOS_57_PT_2X_ICON = exports.IOS_57_PT_ICON = exports.IOS_50_PT_2X_ICON = exports.IOS_50_PT_ICON = exports.IOS_40_PT_3X_ICON = exports.IOS_40_PT_2X_ICON = exports.IOS_40_PT_ICON = exports.IOS_29_PT_3X_ICON = exports.IOS_29_PT_2X_ICON = exports.IOS_29_PT_ICON = exports.IOS_20_PT_3X_ICON = exports.IOS_20_PT_2X_ICON = exports.IOS_20_PT_ICON = exports.ANDROID_SPLASH_RESOURCES = exports.ANDROID_PORT_XXXHDPI_SCREEN = exports.ANDROID_PORT_XXHDPI_SCREEN = exports.ANDROID_PORT_XHDPI_SCREEN = exports.ANDROID_PORT_HDPI_SCREEN = exports.ANDROID_PORT_MDPI_SCREEN = exports.ANDROID_PORT_LDPI_SCREEN = exports.ANDROID_LAND_XXXHDPI_SCREEN = exports.ANDROID_LAND_XXHDPI_SCREEN = exports.ANDROID_LAND_XHDPI_SCREEN = exports.ANDROID_LAND_HDPI_SCREEN = exports.ANDROID_LAND_MDPI_SCREEN = exports.ANDROID_LAND_LDPI_SCREEN = exports.ANDROID_ICON_RESOURCES = exports.ANDROID_XXXHDPI_ICON = exports.ANDROID_XXHDPI_ICON = exports.ANDROID_XHDPI_ICON = exports.ANDROID_HDPI_ICON = exports.ANDROID_MDPI_ICON = exports.ANDROID_LDPI_ICON = exports.ANDROID_ADAPTIVE_ICON_RESOURCES = exports.ANDROID_XXXHDPI_ADAPTIVE_ICON = exports.ANDROID_XXHDPI_ADAPTIVE_ICON = exports.ANDROID_XHDPI_ADAPTIVE_ICON = exports.ANDROID_HDPI_ADAPTIVE_ICON = exports.ANDROID_MDPI_ADAPTIVE_ICON = exports.ANDROID_LDPI_ADAPTIVE_ICON = exports.WINDOWS_SPLASH_RESOURCES = exports.WINDOWS_SPLASH_SCREEN = exports.WINDOWS_ICON_RESOURCES = exports.WINDOWS_STORE_LOGO = exports.WINDOWS_WIDE_310_X_150_LOGO = exports.WINDOWS_SQUARE_310_X_310_ICON = exports.WINDOWS_SQUARE_150_X_150_ICON = exports.WINDOWS_SQUARE_71_X_71_ICON = exports.WINDOWS_SQUARE_44_X_44_ICON = exports.generateScaledWindowsResources = exports.generateScaledWindowsResource = exports.generateScaledWindowsResourceSrc = exports.getSimpleResources = exports.isSupportedResourceType = exports.validateResourceTypes = exports.prettyResourceType = exports.validateResource = exports.getRasterResourceSchema = exports.COLOR_REGEX = exports.validateRasterResource = exports.isRasterResourceFormat = exports.isResourceFormat = exports.RESOURCE_RASTER_FORMATS = exports.RESOURCE_FORMATS = exports.RESOURCE_TYPES = void 0;
const tslib_1 = require("tslib");

@@ -61,3 +62,3 @@ const path_1 = tslib_1.__importDefault(require("path"));

exports.validateRasterResource = validateRasterResource;
exports.COLOR_REGEX = /^\#[A-F0-9]{6}$/;
exports.COLOR_REGEX = /^#[A-F0-9]{6}$/;
function getRasterResourceSchema(platform, type) {

@@ -64,0 +65,0 @@ switch (platform) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.indexCombinatoryIterator = exports.combinationJoiner = exports.flatten = void 0;
function flatten(t) {
return [].concat.apply([], t);
return [].concat(...t);
}

@@ -6,0 +7,0 @@ exports.flatten = flatten;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getOptionValue = void 0;
function getOptionValue(args, arg, defaultValue) {

@@ -4,0 +5,0 @@ const i = args.indexOf(arg);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.identity = exports.tryFn = void 0;
const tslib_1 = require("tslib");

@@ -4,0 +5,0 @@ const debug_1 = tslib_1.__importDefault(require("debug"));

{
"name": "cordova-res",
"version": "0.15.1",
"version": "0.15.2",
"description": "This tool will crop and resize PNG source images into appropriate sizes for modern iOS and Android devices.",

@@ -20,4 +20,7 @@ "homepage": "https://ionicframework.com",

"test": "jest --maxWorkers=4",
"lint": "npm run eslint && npm run prettier -- --check",
"fmt": "npm run eslint -- --fix && npm run prettier -- --write",
"eslint": "eslint . --ext ts",
"prettier": "prettier 'src/**/*.ts'",
"fmt": "npm run prettier -- --write",
"release": "np",
"prepublishOnly": "npm run build"

@@ -30,2 +33,6 @@ },

},
"prettier": "@ionic/prettier-config",
"eslintConfig": {
"extends": "@ionic/eslint-config/recommended"
},
"files": [

@@ -53,22 +60,26 @@ "bin",

"dependencies": {
"@ionic/utils-array": "^2.1.1",
"@ionic/utils-fs": "^3.0.0",
"debug": "^4.1.1",
"@ionic/utils-array": "^2.1.5",
"@ionic/utils-fs": "^3.1.5",
"debug": "^4.2.0",
"elementtree": "^0.1.7",
"sharp": "^0.25.1",
"tslib": "^1.9.3"
"sharp": "^0.26.0",
"tslib": "^2.0.3"
},
"devDependencies": {
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^1.0.1",
"@types/debug": "^4.1.5",
"@types/elementtree": "^0.1.0",
"@types/fs-extra": "^8.0.0",
"@types/jest": "^25.1.0",
"@types/jest": "^26.0.14",
"@types/node": "~10.17.13",
"@types/sharp": "^0.25.0",
"husky": "^4.0.9",
"@types/sharp": "^0.26.0",
"eslint": "^7.11.0",
"husky": "^4.3.0",
"jest": "~25.5.0",
"prettier": "^2.0.5",
"np": "^7.0.0",
"prettier": "^2.1.2",
"ts-jest": "~25.5.0",
"typescript": "~3.8.2"
"typescript": "~3.9.7"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc