New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@atelier-wb/vite-plugin-atelier

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atelier-wb/vite-plugin-atelier - npm Package Compare versions

Comparing version 0.12.0-beta.0 to 0.12.0-beta.1

4

package.json
{
"name": "@atelier-wb/vite-plugin-atelier",
"version": "0.12.0-beta.0",
"version": "0.12.0-beta.1",
"description": "Helps you buildind Component Driven UIs with Atelier and Vite",

@@ -10,3 +10,3 @@ "main": "src/index.js",

"sirv": "^2.0.3",
"@atelier-wb/ui": "0.12.0-beta.0"
"@atelier-wb/ui": "0.12.0-beta.1"
},

@@ -13,0 +13,0 @@ "peerDependencies": {

import Ajv from 'ajv'
import { createReadStream } from 'fs'
import { cp, readdir, readFile, rm, stat, writeFile } from 'fs/promises'

@@ -8,3 +7,3 @@ import { createRequire } from 'module'

import { fileURLToPath } from 'url'
import { normalizePath, searchForWorkspaceRoot } from 'vite'
import { mergeConfig, normalizePath, searchForWorkspaceRoot } from 'vite'

@@ -56,3 +55,4 @@ const ui = dirname(createRequire(import.meta.url).resolve('@atelier-wb/ui'))

uiSettings: {},
outDir: 'dist-atelier'
outDir: 'dist-atelier',
unoGlobalCSSPlaceholder: '%unocss-svelte-scoped.global%'
}

@@ -124,2 +124,29 @@

async function invokeConfigResolved(plugins, config) {
for (const plugin of plugins) {
if (
plugin?.name !== pluginName &&
typeof plugin?.configResolved === 'function'
) {
config = mergeConfig((await plugin.configResolved(config)) ?? {}, config)
}
}
}
async function invokeTransformIndexHtml(plugins, content, context) {
for (const plugin of plugins) {
if (typeof plugin?.transformIndexHtml === 'function') {
const result = await plugin.transformIndexHtml(content, context)
// https://vitejs.dev/guide/api-plugin.html#transformindexhtml
// HtmlTagDescriptor are not supported yet
if (typeof result === 'string') {
content = result
} else if (typeof result === 'object' && result.html) {
content = result.html
}
}
}
return content
}
export default function AtelierPlugin(

@@ -155,2 +182,3 @@ pluginOptions = {},

let entryFile
let vitePlugins = []

@@ -187,2 +215,5 @@ return {

async configResolved(viteConfig) {
vitePlugins = viteConfig.plugins ?? []
await invokeConfigResolved(vitePlugins, viteConfig)
if (isExporting) {

@@ -207,2 +238,10 @@ root = viteConfig.root

const serves = statics.map(dir => sirv(dir, { etag: true }))
const content = (await readFile(options.workframeHtml, 'utf8')).replace(
vitePlugins.some(
({ name }) => name === 'unocss:svelte-scoped:global-styles'
)
? '</head>'
: 'does-not-exist',
`${options.unoGlobalCSSPlaceholder}\n</head>`
)

@@ -217,3 +256,7 @@ // configure a middleware for serving Atelier

})
createReadStream(options.workframeHtml).pipe(response)
invokeTransformIndexHtml(vitePlugins, content, {
path: options.workframeHtml,
fileName: options.workframeHtml
}).then(result => response.end(result))
} else if (request.url === `/${settingsFile}`) {

@@ -220,0 +263,0 @@ response.writeHead(200, {

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