react-cosmos
Advanced tools
Comparing version
@@ -19,1 +19,2 @@ import { RendererConfig } from 'react-cosmos-core'; | ||
export declare function importPath(filePath: string, relativeToDir: string | null): string; | ||
export declare function sortedImportKeys(importMap: Record<string, string>): string[]; |
@@ -36,1 +36,4 @@ import path from 'path'; | ||
} | ||
export function sortedImportKeys(importMap) { | ||
return Object.keys(importMap).sort(); | ||
} |
import { flatten } from 'lodash-es'; | ||
import { createImportMap, importPath, } from './shared.js'; | ||
import { createImportMap, importPath, sortedImportKeys, } from './shared.js'; | ||
export function userImportsLazyTemplate({ globalImports, modulePaths: { fixturePaths, decoratorPaths }, rendererConfig, rootDir, relativeToDir, typeScript, }) { | ||
@@ -13,6 +13,6 @@ function ext(filePath) { | ||
const fixtures = createImportMap(fixturePaths, rootDir, relativeToDir); | ||
const fixtureKeys = Object.keys(fixtures); | ||
const fixtureKeys = sortedImportKeys(fixtures); | ||
const fixtureItems = fixtureKeys.map(k => ` '${k}': { getModule: () => import('${ext(fixtures[k])}') }`); | ||
const decorators = createImportMap(decoratorPaths, rootDir, relativeToDir); | ||
const decoratorKeys = Object.keys(decorators); | ||
const decoratorKeys = sortedImportKeys(decorators); | ||
const decoratorItems = decoratorKeys.map(k => ` '${k}': { getModule: () => import('${ext(decorators[k])}') }`); | ||
@@ -19,0 +19,0 @@ const rendererConfigStr = JSON.stringify(rendererConfig, null, 2); |
import { flatten } from 'lodash-es'; | ||
import { createImportMap, importPath, } from './shared.js'; | ||
import { createImportMap, importPath, sortedImportKeys, } from './shared.js'; | ||
export function userImportsTemplate({ globalImports, modulePaths: { fixturePaths, decoratorPaths }, rendererConfig, rootDir, relativeToDir, typeScript, }) { | ||
@@ -13,7 +13,7 @@ function ext(filePath) { | ||
const fixtures = createImportMap(fixturePaths, rootDir, relativeToDir); | ||
const fixtureKeys = Object.keys(fixtures); | ||
const fixtureKeys = sortedImportKeys(fixtures); | ||
const fixtureImports = fixtureKeys.map((k, i) => `import * as fixture${i} from '${ext(fixtures[k])}';`); | ||
const fixtureItems = fixtureKeys.map((k, i) => ` '${k}': { module: fixture${i} }`); | ||
const decorators = createImportMap(decoratorPaths, rootDir, relativeToDir); | ||
const decoratorKeys = Object.keys(decorators); | ||
const decoratorKeys = sortedImportKeys(decorators); | ||
const decoratorImports = decoratorKeys.map((k, i) => `import * as decorator${i} from '${ext(decorators[k])}';`); | ||
@@ -20,0 +20,0 @@ const decoratorItems = decoratorKeys.map((k, i) => ` '${k}': { module: decorator${i} }`); |
{ | ||
"name": "react-cosmos", | ||
"version": "7.0.0-canary.9cb6dec.0+9cb6dec", | ||
"version": "7.0.0-canary.9d8ca03.0+9d8ca03", | ||
"description": "Sandbox for developing and testing UI components in isolation", | ||
@@ -18,6 +18,6 @@ "repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos", | ||
"open": "10.1.1", | ||
"pem": "1.15.1", | ||
"react-cosmos-core": "7.0.0-canary.9cb6dec.0+9cb6dec", | ||
"react-cosmos-renderer": "7.0.0-canary.9cb6dec.0+9cb6dec", | ||
"react-cosmos-ui": "7.0.0-canary.9cb6dec.0+9cb6dec", | ||
"pem": "1.14.8", | ||
"react-cosmos-core": "7.0.0-canary.9d8ca03.0+9d8ca03", | ||
"react-cosmos-renderer": "7.0.0-canary.9d8ca03.0+9d8ca03", | ||
"react-cosmos-ui": "7.0.0-canary.9d8ca03.0+9d8ca03", | ||
"ws": "8.18.1", | ||
@@ -31,3 +31,3 @@ "yargs": "17.7.2" | ||
}, | ||
"gitHead": "9cb6dec50b93e32c061d2d7613c642ab1b6eea13" | ||
"gitHead": "9d8ca038bd84608e1b5c3da162f3833a63f5b522" | ||
} |
@@ -7,3 +7,3 @@ <p align="center"> | ||
<p align="center"> | ||
<a aria-label="npm version" href="https://www.npmjs.com/package/react-cosmos"><img src="https://img.shields.io/npm/v/react-cosmos.svg?style=flat&colorA=000000&colorB=000000" alt="" /></a> | ||
<a aria-label="npm version" href="https://www.npmjs.com/package/react-cosmos"><img src="https://img.shields.io/npm/v/react-cosmos/next.svg?style=flat&colorA=000000&colorB=000000" alt="" /></a> | ||
<a aria-label="CI Status" href="https://github.com/react-cosmos/react-cosmos/actions/workflows/test.yml"><img src="https://img.shields.io/github/actions/workflow/status/react-cosmos/react-cosmos/test.yml?branch=main&style=flat&colorA=000000&colorB=000000" alt="" /></a> | ||
@@ -10,0 +10,0 @@ <a aria-label="Codecov" href="https://app.codecov.io/gh/react-cosmos/react-cosmos"><img src="https://img.shields.io/codecov/c/github/react-cosmos/react-cosmos?colorA=000000&colorB=000000" alt="" /></a> |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
112260
0.21%2217
0.18%+ Added
- Removed
Updated