@enhance/arc-plugin-styles
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "@enhance/arc-plugin-styles", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Plugin for generating enhance CSS utility classes", | ||
@@ -31,12 +31,11 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"@architect/functions": "^5.2.1", | ||
"@enhance/styles": "^2.0.2", | ||
"esm": "^3.2.25" | ||
"@architect/functions": "^5.2.3", | ||
"@enhance/styles": "^2.0.2" | ||
}, | ||
"devDependencies": { | ||
"@architect/eslint-config": "^2.0.1", | ||
"@architect/sandbox": "^5.3.1", | ||
"eslint": "^8.20.0", | ||
"@architect/sandbox": "^5.3.4", | ||
"eslint": "^8.26.0", | ||
"tap-arc": "^0.3.5", | ||
"tape": "^5.5.3", | ||
"tape": "^5.6.1", | ||
"tiny-json-http": "^7.4.2" | ||
@@ -43,0 +42,0 @@ }, |
@@ -1,13 +0,21 @@ | ||
// eslint-disable-next-line | ||
require = require('esm')(module) | ||
const { readFileSync, writeFileSync } = require('node:fs') | ||
const path = require('node:path') | ||
const { readFileSync, writeFileSync } = require('fs') | ||
const path = require('path') | ||
const enhanceStyles = require('@enhance/styles/index.mjs').default | ||
const sandbox = { | ||
start (params) { | ||
verify(params) | ||
generateAndSave(createConfig(params)) | ||
async start (params) { | ||
if (verify(params)) { | ||
const config = createConfig(params) | ||
await generateAndSave(config) | ||
} | ||
}, | ||
async watcher (params) { | ||
if (verify(params)) { | ||
const { filename } = params | ||
const config = createConfig(params) | ||
if (filename === config.pathToConfig) { | ||
await generateAndSave(config) | ||
} | ||
} | ||
} | ||
} | ||
@@ -33,5 +41,9 @@ | ||
function verify ({ arc, inventory }) { | ||
// TODO: helpful error if inventory doesn't have static or static.folder | ||
// TODO: helpful error if @enhance-styles not set in arc | ||
return inventory.inv.static?.folder && arc['enhance-styles']?.length > 0 | ||
const hasStatic = inventory.inv.static?.folder | ||
const hasConfig = arc['enhance-styles']?.length > 0 | ||
if (!hasStatic) { console.warn(' Enhance Styles: Architect static must be enabled') } | ||
if (!hasConfig) { console.warn(' Enhance Styles: @enhance-styles config required') } | ||
return hasStatic && hasConfig | ||
} | ||
@@ -44,3 +56,3 @@ | ||
* @param {object} params.inventory | ||
* @returns {{stylesConfig: string, path: string}} | ||
* @returns {{stylesConfig: string, path: string, pathToConfig: null|string}} | ||
*/ | ||
@@ -78,2 +90,3 @@ function createConfig ({ arc, inventory }) { | ||
path: pathToStaticStyles, | ||
pathToConfig, | ||
} | ||
@@ -88,3 +101,4 @@ } | ||
*/ | ||
function generateAndSave ({ stylesConfig, path }) { | ||
async function generateAndSave ({ stylesConfig, path }) { | ||
const { default: enhanceStyles } = await import('@enhance/styles') | ||
const styles = enhanceStyles(stylesConfig) | ||
@@ -91,0 +105,0 @@ writeFileSync(path, styles) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
22250
2
6
101
0
1
- Removedesm@^3.2.25
- Removedesm@3.2.25(transitive)
Updated@architect/functions@^5.2.3