- Node/Express/TypeScript API under /api/v1 with JWT auth (login, refresh, logout, /me) - Prisma schema: vendors, users, roles, products, categories, taxes, transactions - SQLite for local dev; Postgres via docker-compose for production - Full CRUD routes for vendors, users, categories, taxes, products with Zod validation and RBAC - Paginated list endpoints scoped per vendor; refresh token rotation - React/TypeScript admin SPA (Vite): login, protected routing, sidebar layout - Pages: Dashboard, Catalog (tabbed Products/Categories/Taxes), Users, Vendor Settings - Shared UI: Table, Modal, FormField, Btn, PageHeader components - Multi-stage Dockerfile; docker-compose with Postgres healthcheck - Seed script with demo vendor and owner account - INSTRUCTIONS.md, ROADMAP.md, .claude/launch.json for dev server config Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
'use strict'
|
|
|
|
let Document = require('./document')
|
|
let LazyResult = require('./lazy-result')
|
|
let NoWorkResult = require('./no-work-result')
|
|
let Root = require('./root')
|
|
|
|
class Processor {
|
|
constructor(plugins = []) {
|
|
this.version = '8.5.8'
|
|
this.plugins = this.normalize(plugins)
|
|
}
|
|
|
|
normalize(plugins) {
|
|
let normalized = []
|
|
for (let i of plugins) {
|
|
if (i.postcss === true) {
|
|
i = i()
|
|
} else if (i.postcss) {
|
|
i = i.postcss
|
|
}
|
|
|
|
if (typeof i === 'object' && Array.isArray(i.plugins)) {
|
|
normalized = normalized.concat(i.plugins)
|
|
} else if (typeof i === 'object' && i.postcssPlugin) {
|
|
normalized.push(i)
|
|
} else if (typeof i === 'function') {
|
|
normalized.push(i)
|
|
} else if (typeof i === 'object' && (i.parse || i.stringify)) {
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
throw new Error(
|
|
'PostCSS syntaxes cannot be used as plugins. Instead, please use ' +
|
|
'one of the syntax/parser/stringifier options as outlined ' +
|
|
'in your PostCSS runner documentation.'
|
|
)
|
|
}
|
|
} else {
|
|
throw new Error(i + ' is not a PostCSS plugin')
|
|
}
|
|
}
|
|
return normalized
|
|
}
|
|
|
|
process(css, opts = {}) {
|
|
if (
|
|
!this.plugins.length &&
|
|
!opts.parser &&
|
|
!opts.stringifier &&
|
|
!opts.syntax
|
|
) {
|
|
return new NoWorkResult(this, css, opts)
|
|
} else {
|
|
return new LazyResult(this, css, opts)
|
|
}
|
|
}
|
|
|
|
use(plugin) {
|
|
this.plugins = this.plugins.concat(this.normalize([plugin]))
|
|
return this
|
|
}
|
|
}
|
|
|
|
module.exports = Processor
|
|
Processor.default = Processor
|
|
|
|
Root.registerProcessor(Processor)
|
|
Document.registerProcessor(Processor)
|