@analogjs/vite-plugin-angular 3.0.0-alpha.33 → 3.0.0-alpha.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/lib/host.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { debugStyles } from "./utils/debug.js";
2
+ import { isTailwindReferenceError } from "./utils/tailwind-reference.js";
2
3
  import { normalizeStylesheetDependencies } from "./style-preprocessor.js";
3
4
  import { preprocessStylesheetResult, registerStylesheetContent } from "./stylesheet-registry.js";
4
5
  import { createHash } from "node:crypto";
@@ -57,6 +58,7 @@ function augmentHostWithResources(host, transform, options) {
57
58
  try {
58
59
  stylesheetResult = await transform(preprocessed.code, `${filename}?direct`);
59
60
  } catch (e) {
61
+ if (isTailwindReferenceError(e)) throw e;
60
62
  debugStyles("NgtscProgram: stylesheet transform error", {
61
63
  filename,
62
64
  resourceFile: context.resourceFile ?? "(inline)",
@@ -1 +1 @@
1
- {"version":3,"file":"host.js","names":[],"sources":["../../../src/lib/host.ts"],"sourcesContent":["import type { CompilerHost } from '@angular/compiler-cli';\nimport { normalizePath } from 'vite';\n\nimport * as ts from 'typescript';\n\nimport { createHash } from 'node:crypto';\nimport path from 'node:path';\nimport {\n normalizeStylesheetDependencies,\n type StylePreprocessor,\n} from './style-preprocessor.js';\nimport {\n AnalogStylesheetRegistry,\n preprocessStylesheetResult,\n registerStylesheetContent,\n} from './stylesheet-registry.js';\nimport { debugStyles } from './utils/debug.js';\nimport type { SourceFileCache } from './utils/source-file-cache.js';\n\nexport function augmentHostWithResources(\n host: ts.CompilerHost,\n transform: (\n code: string,\n id: string,\n options?: { ssr?: boolean },\n ) => ReturnType<any> | null,\n options: {\n inlineStylesExtension: string;\n isProd?: boolean;\n stylesheetRegistry?: AnalogStylesheetRegistry;\n sourceFileCache?: SourceFileCache;\n stylePreprocessor?: StylePreprocessor;\n },\n): void {\n const resourceHost = host as CompilerHost;\n\n resourceHost.readResource = async function (fileName: string) {\n const filePath = normalizePath(fileName);\n\n const content = (this as any).readFile(filePath);\n\n if (content === undefined) {\n throw new Error('Unable to locate component resource: ' + fileName);\n }\n\n return content;\n };\n\n resourceHost.getModifiedResourceFiles = function () {\n return options?.sourceFileCache?.modifiedFiles;\n };\n\n resourceHost.transformResource = async function (data, context) {\n // Only style resources are supported currently\n if (context.type !== 'style') {\n return null;\n }\n\n const filename =\n context.resourceFile ??\n context.containingFile.replace(\n '.ts',\n `.${options?.inlineStylesExtension}`,\n );\n const preprocessed = preprocessStylesheetResult(\n data,\n filename,\n options.stylePreprocessor,\n {\n filename,\n containingFile: context.containingFile,\n resourceFile: context.resourceFile ?? undefined,\n className: context.className,\n order: context.order,\n inline: !context.resourceFile,\n },\n );\n\n // Externalized path: store preprocessed CSS for Vite's serve-time pipeline.\n // CSS must NOT be transformed here — the load hook returns it into\n // Vite's transform pipeline where PostCSS / Tailwind process it once.\n if (options.stylesheetRegistry) {\n const stylesheetId = registerStylesheetContent(\n options.stylesheetRegistry,\n {\n code: preprocessed.code,\n dependencies: normalizeStylesheetDependencies(\n preprocessed.dependencies,\n ),\n diagnostics: preprocessed.diagnostics,\n tags: preprocessed.tags,\n containingFile: context.containingFile,\n className: context.className,\n order: context.order,\n inlineStylesExtension: options.inlineStylesExtension,\n resourceFile: context.resourceFile ?? undefined,\n },\n );\n debugStyles('NgtscProgram: stylesheet deferred to Vite pipeline', {\n stylesheetId,\n resourceFile: context.resourceFile ?? '(inline)',\n dependencies: preprocessed.dependencies,\n diagnostics: preprocessed.diagnostics,\n tags: preprocessed.tags,\n });\n return { content: stylesheetId };\n }\n\n // Non-externalized: CSS is returned directly to the Angular compiler\n // and never re-enters Vite's pipeline, so transform eagerly.\n debugStyles('NgtscProgram: stylesheet processed inline via transform', {\n filename,\n resourceFile: context.resourceFile ?? '(inline)',\n dataLength: preprocessed.code.length,\n });\n let stylesheetResult;\n\n try {\n stylesheetResult = await transform(\n preprocessed.code,\n `${filename}?direct`,\n );\n } catch (e) {\n debugStyles('NgtscProgram: stylesheet transform error', {\n filename,\n resourceFile: context.resourceFile ?? '(inline)',\n error: String(e),\n });\n }\n\n if (!stylesheetResult?.code) {\n return null;\n }\n\n return { content: stylesheetResult.code };\n };\n\n resourceHost.resourceNameToFileName = function (\n resourceName,\n containingFile,\n fallbackResolve,\n ) {\n const resolvedPath = normalizePath(\n fallbackResolve\n ? fallbackResolve(path.dirname(containingFile), resourceName)\n : path.join(path.dirname(containingFile), resourceName),\n );\n\n // All resource names that have template file extensions are assumed to be templates\n if (!options.stylesheetRegistry || !hasStyleExtension(resolvedPath)) {\n return resolvedPath;\n }\n\n // For external stylesheets, create a unique identifier and store the mapping\n const externalId = createHash('sha256').update(resolvedPath).digest('hex');\n const filename = externalId + path.extname(resolvedPath);\n\n options.stylesheetRegistry.registerExternalRequest(filename, resolvedPath);\n debugStyles('NgtscProgram: external stylesheet ID mapped for resolveId', {\n resourceName,\n resolvedPath,\n filename,\n });\n\n return filename;\n };\n}\n\nexport function augmentProgramWithVersioning(program: ts.Program): void {\n const baseGetSourceFiles = program.getSourceFiles;\n program.getSourceFiles = function (...parameters) {\n const files: readonly (ts.SourceFile & { version?: string })[] =\n baseGetSourceFiles(...parameters);\n\n for (const file of files) {\n file.version ??= createHash('sha256').update(file.text).digest('hex');\n }\n\n return files;\n };\n}\n\nexport function augmentHostWithCaching(\n host: ts.CompilerHost,\n cache: Map<string, ts.SourceFile>,\n): void {\n const baseGetSourceFile = host.getSourceFile;\n host.getSourceFile = function (\n fileName,\n languageVersion,\n onError,\n shouldCreateNewSourceFile,\n ...parameters\n ) {\n if (!shouldCreateNewSourceFile && cache.has(fileName)) {\n return cache.get(fileName);\n }\n\n const file = baseGetSourceFile.call(\n host,\n fileName,\n languageVersion,\n onError,\n true,\n ...parameters,\n );\n\n if (file) {\n cache.set(fileName, file);\n }\n\n return file;\n };\n}\n\nexport function mergeTransformers(\n first: ts.CustomTransformers,\n second: ts.CustomTransformers,\n): ts.CustomTransformers {\n const result: ts.CustomTransformers = {};\n\n if (first.before || second.before) {\n result.before = [...(first.before || []), ...(second.before || [])];\n }\n\n if (first.after || second.after) {\n result.after = [...(first.after || []), ...(second.after || [])];\n }\n\n if (first.afterDeclarations || second.afterDeclarations) {\n result.afterDeclarations = [\n ...(first.afterDeclarations || []),\n ...(second.afterDeclarations || []),\n ];\n }\n\n return result;\n}\n\nfunction hasStyleExtension(file: string): boolean {\n const extension = path.extname(file).toLowerCase();\n\n switch (extension) {\n case '.css':\n case '.scss':\n return true;\n default:\n return false;\n }\n}\n"],"mappings":";;;;;;;AAmBA,SAAgB,yBACd,MACA,WAKA,SAOM;CACN,MAAM,eAAe;AAErB,cAAa,eAAe,eAAgB,UAAkB;EAC5D,MAAM,WAAW,cAAc,SAAS;EAExC,MAAM,UAAW,KAAa,SAAS,SAAS;AAEhD,MAAI,YAAY,KAAA,EACd,OAAM,IAAI,MAAM,0CAA0C,SAAS;AAGrE,SAAO;;AAGT,cAAa,2BAA2B,WAAY;AAClD,SAAO,SAAS,iBAAiB;;AAGnC,cAAa,oBAAoB,eAAgB,MAAM,SAAS;AAE9D,MAAI,QAAQ,SAAS,QACnB,QAAO;EAGT,MAAM,WACJ,QAAQ,gBACR,QAAQ,eAAe,QACrB,OACA,IAAI,SAAS,wBACd;EACH,MAAM,eAAe,2BACnB,MACA,UACA,QAAQ,mBACR;GACE;GACA,gBAAgB,QAAQ;GACxB,cAAc,QAAQ,gBAAgB,KAAA;GACtC,WAAW,QAAQ;GACnB,OAAO,QAAQ;GACf,QAAQ,CAAC,QAAQ;GAClB,CACF;AAKD,MAAI,QAAQ,oBAAoB;GAC9B,MAAM,eAAe,0BACnB,QAAQ,oBACR;IACE,MAAM,aAAa;IACnB,cAAc,gCACZ,aAAa,aACd;IACD,aAAa,aAAa;IAC1B,MAAM,aAAa;IACnB,gBAAgB,QAAQ;IACxB,WAAW,QAAQ;IACnB,OAAO,QAAQ;IACf,uBAAuB,QAAQ;IAC/B,cAAc,QAAQ,gBAAgB,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AAM,oBAAoB,KAAK;AAC/B,MAAK,gBAAgB,SACnB,UACA,iBACA,SACA,2BACA,GAAG,YACH;AACA,MAAI,CAAC,6BAA6B,MAAM,IAAI,SAAS,CACnD,QAAO,MAAM,IAAI,SAAS;EAG5B,MAAM,OAAO,kBAAkB,KAC7B,MACA,UACA,iBACA,SACA,MACA,GAAG,WACJ;AAED,MAAI,KACF,OAAM,IAAI,UAAU,KAAK;AAG3B,SAAO;;;AAIX,SAAgB,kBACd,OACA,QACuB;CACvB,MAAM,SAAgC,EAAE;AAExC,KAAI,MAAM,UAAU,OAAO,OACzB,QAAO,SAAS,CAAC,GAAI,MAAM,UAAU,EAAE,EAAG,GAAI,OAAO,UAAU,EAAE,CAAE;AAGrE,KAAI,MAAM,SAAS,OAAO,MACxB,QAAO,QAAQ,CAAC,GAAI,MAAM,SAAS,EAAE,EAAG,GAAI,OAAO,SAAS,EAAE,CAAE;AAGlE,KAAI,MAAM,qBAAqB,OAAO,kBACpC,QAAO,oBAAoB,CACzB,GAAI,MAAM,qBAAqB,EAAE,EACjC,GAAI,OAAO,qBAAqB,EAAE,CACnC;AAGH,QAAO;;AAGT,SAAS,kBAAkB,MAAuB;AAGhD,SAFkB,KAAK,QAAQ,KAAK,CAAC,aAAa,EAElD;EACE,KAAK;EACL,KAAK,QACH,QAAO;EACT,QACE,QAAO"}
1
+ {"version":3,"file":"host.js","names":[],"sources":["../../../src/lib/host.ts"],"sourcesContent":["import type { CompilerHost } from '@angular/compiler-cli';\nimport { normalizePath } from 'vite';\n\nimport * as ts from 'typescript';\n\nimport { createHash } from 'node:crypto';\nimport path from 'node:path';\nimport {\n normalizeStylesheetDependencies,\n type StylePreprocessor,\n} from './style-preprocessor.js';\nimport {\n AnalogStylesheetRegistry,\n preprocessStylesheetResult,\n registerStylesheetContent,\n} from './stylesheet-registry.js';\nimport { debugStyles } from './utils/debug.js';\nimport type { SourceFileCache } from './utils/source-file-cache.js';\nimport { isTailwindReferenceError } from './utils/tailwind-reference.js';\n\nexport function augmentHostWithResources(\n host: ts.CompilerHost,\n transform: (\n code: string,\n id: string,\n options?: { ssr?: boolean },\n ) => ReturnType<any> | null,\n options: {\n inlineStylesExtension: string;\n isProd?: boolean;\n stylesheetRegistry?: AnalogStylesheetRegistry;\n sourceFileCache?: SourceFileCache;\n stylePreprocessor?: StylePreprocessor;\n },\n): void {\n const resourceHost = host as CompilerHost;\n\n resourceHost.readResource = async function (fileName: string) {\n const filePath = normalizePath(fileName);\n\n const content = (this as any).readFile(filePath);\n\n if (content === undefined) {\n throw new Error('Unable to locate component resource: ' + fileName);\n }\n\n return content;\n };\n\n resourceHost.getModifiedResourceFiles = function () {\n return options?.sourceFileCache?.modifiedFiles;\n };\n\n resourceHost.transformResource = async function (data, context) {\n // Only style resources are supported currently\n if (context.type !== 'style') {\n return null;\n }\n\n const filename =\n context.resourceFile ??\n context.containingFile.replace(\n '.ts',\n `.${options?.inlineStylesExtension}`,\n );\n const preprocessed = preprocessStylesheetResult(\n data,\n filename,\n options.stylePreprocessor,\n {\n filename,\n containingFile: context.containingFile,\n resourceFile: context.resourceFile ?? undefined,\n className: context.className,\n order: context.order,\n inline: !context.resourceFile,\n },\n );\n\n // Externalized path: store preprocessed CSS for Vite's serve-time pipeline.\n // CSS must NOT be transformed here — the load hook returns it into\n // Vite's transform pipeline where PostCSS / Tailwind process it once.\n if (options.stylesheetRegistry) {\n const stylesheetId = registerStylesheetContent(\n options.stylesheetRegistry,\n {\n code: preprocessed.code,\n dependencies: normalizeStylesheetDependencies(\n preprocessed.dependencies,\n ),\n diagnostics: preprocessed.diagnostics,\n tags: preprocessed.tags,\n containingFile: context.containingFile,\n className: context.className,\n order: context.order,\n inlineStylesExtension: options.inlineStylesExtension,\n resourceFile: context.resourceFile ?? undefined,\n },\n );\n debugStyles('NgtscProgram: stylesheet deferred to Vite pipeline', {\n stylesheetId,\n resourceFile: context.resourceFile ?? '(inline)',\n dependencies: preprocessed.dependencies,\n diagnostics: preprocessed.diagnostics,\n tags: preprocessed.tags,\n });\n return { content: stylesheetId };\n }\n\n // Non-externalized: CSS is returned directly to the Angular compiler\n // and never re-enters Vite's pipeline, so transform eagerly.\n debugStyles('NgtscProgram: stylesheet processed inline via transform', {\n filename,\n resourceFile: context.resourceFile ?? '(inline)',\n dataLength: preprocessed.code.length,\n });\n let stylesheetResult;\n\n try {\n stylesheetResult = await transform(\n preprocessed.code,\n `${filename}?direct`,\n );\n } catch (e) {\n if (isTailwindReferenceError(e)) {\n throw e;\n }\n debugStyles('NgtscProgram: stylesheet transform error', {\n filename,\n resourceFile: context.resourceFile ?? '(inline)',\n error: String(e),\n });\n }\n\n if (!stylesheetResult?.code) {\n return null;\n }\n\n return { content: stylesheetResult.code };\n };\n\n resourceHost.resourceNameToFileName = function (\n resourceName,\n containingFile,\n fallbackResolve,\n ) {\n const resolvedPath = normalizePath(\n fallbackResolve\n ? fallbackResolve(path.dirname(containingFile), resourceName)\n : path.join(path.dirname(containingFile), resourceName),\n );\n\n // All resource names that have template file extensions are assumed to be templates\n if (!options.stylesheetRegistry || !hasStyleExtension(resolvedPath)) {\n return resolvedPath;\n }\n\n // For external stylesheets, create a unique identifier and store the mapping\n const externalId = createHash('sha256').update(resolvedPath).digest('hex');\n const filename = externalId + path.extname(resolvedPath);\n\n options.stylesheetRegistry.registerExternalRequest(filename, resolvedPath);\n debugStyles('NgtscProgram: external stylesheet ID mapped for resolveId', {\n resourceName,\n resolvedPath,\n filename,\n });\n\n return filename;\n };\n}\n\nexport function augmentProgramWithVersioning(program: ts.Program): void {\n const baseGetSourceFiles = program.getSourceFiles;\n program.getSourceFiles = function (...parameters) {\n const files: readonly (ts.SourceFile & { version?: string })[] =\n baseGetSourceFiles(...parameters);\n\n for (const file of files) {\n file.version ??= createHash('sha256').update(file.text).digest('hex');\n }\n\n return files;\n };\n}\n\nexport function augmentHostWithCaching(\n host: ts.CompilerHost,\n cache: Map<string, ts.SourceFile>,\n): void {\n const baseGetSourceFile = host.getSourceFile;\n host.getSourceFile = function (\n fileName,\n languageVersion,\n onError,\n shouldCreateNewSourceFile,\n ...parameters\n ) {\n if (!shouldCreateNewSourceFile && cache.has(fileName)) {\n return cache.get(fileName);\n }\n\n const file = baseGetSourceFile.call(\n host,\n fileName,\n languageVersion,\n onError,\n true,\n ...parameters,\n );\n\n if (file) {\n cache.set(fileName, file);\n }\n\n return file;\n };\n}\n\nexport function mergeTransformers(\n first: ts.CustomTransformers,\n second: ts.CustomTransformers,\n): ts.CustomTransformers {\n const result: ts.CustomTransformers = {};\n\n if (first.before || second.before) {\n result.before = [...(first.before || []), ...(second.before || [])];\n }\n\n if (first.after || second.after) {\n result.after = [...(first.after || []), ...(second.after || [])];\n }\n\n if (first.afterDeclarations || second.afterDeclarations) {\n result.afterDeclarations = [\n ...(first.afterDeclarations || []),\n ...(second.afterDeclarations || []),\n ];\n }\n\n return result;\n}\n\nfunction hasStyleExtension(file: string): boolean {\n const extension = path.extname(file).toLowerCase();\n\n switch (extension) {\n case '.css':\n case '.scss':\n return true;\n default:\n return false;\n }\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgB,yBACd,MACA,WAKA,SAOM;CACN,MAAM,eAAe;AAErB,cAAa,eAAe,eAAgB,UAAkB;EAC5D,MAAM,WAAW,cAAc,SAAS;EAExC,MAAM,UAAW,KAAa,SAAS,SAAS;AAEhD,MAAI,YAAY,KAAA,EACd,OAAM,IAAI,MAAM,0CAA0C,SAAS;AAGrE,SAAO;;AAGT,cAAa,2BAA2B,WAAY;AAClD,SAAO,SAAS,iBAAiB;;AAGnC,cAAa,oBAAoB,eAAgB,MAAM,SAAS;AAE9D,MAAI,QAAQ,SAAS,QACnB,QAAO;EAGT,MAAM,WACJ,QAAQ,gBACR,QAAQ,eAAe,QACrB,OACA,IAAI,SAAS,wBACd;EACH,MAAM,eAAe,2BACnB,MACA,UACA,QAAQ,mBACR;GACE;GACA,gBAAgB,QAAQ;GACxB,cAAc,QAAQ,gBAAgB,KAAA;GACtC,WAAW,QAAQ;GACnB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) {
9
9
  name: "analogjs-live-reload-plugin",
10
10
  apply: "serve",
11
11
  configureServer(server) {
12
+ if (server.config.server.hmr === false) {
13
+ debugHmr("middleware disabled: vite server.hmr is false");
14
+ return;
15
+ }
12
16
  const angularComponentMiddleware = async (req, res, next) => {
13
17
  if (req.url === void 0 || res.writableEnded) return;
14
18
  if (!req.url.includes(ANGULAR_COMPONENT_PREFIX)) {
@@ -1 +1 @@
1
- {"version":3,"file":"live-reload-plugin.js","names":[],"sources":["../../../src/lib/live-reload-plugin.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { ServerResponse } from 'node:http';\nimport { Connect, normalizePath, Plugin, ViteDevServer } from 'vite';\n\nimport { EmitFileResult } from './models.js';\nimport { debugHmr } from './utils/debug.js';\n\nconst ANGULAR_COMPONENT_PREFIX = '/@ng/component';\nconst FILE_PREFIX = 'file:';\n\nexport function liveReloadPlugin({\n classNames,\n fileEmitter,\n}: {\n classNames: Map<string, string>;\n fileEmitter: (file: string) => EmitFileResult | undefined;\n}): Plugin {\n return {\n name: 'analogjs-live-reload-plugin',\n apply: 'serve',\n configureServer(server: ViteDevServer) {\n const angularComponentMiddleware: Connect.HandleFunction = async (\n req: Connect.IncomingMessage,\n res: ServerResponse<Connect.IncomingMessage>,\n next: Connect.NextFunction,\n ) => {\n if (req.url === undefined || res.writableEnded) {\n return;\n }\n\n if (!req.url.includes(ANGULAR_COMPONENT_PREFIX)) {\n next();\n\n return;\n }\n\n const requestUrl = new URL(req.url, 'http://localhost');\n const componentId = requestUrl.searchParams.get('c');\n\n if (!componentId) {\n res.statusCode = 400;\n res.end();\n\n return;\n }\n\n const [fileId] = decodeURIComponent(componentId).split('@');\n const resolvedId = normalizePath(resolve(process.cwd(), fileId));\n const invalidated =\n !!server.moduleGraph.getModuleById(resolvedId)\n ?.lastInvalidationTimestamp && classNames.get(resolvedId);\n\n // don't send an HMR update until the file has been invalidated\n if (!invalidated) {\n debugHmr('middleware: skipped (not invalidated)', { resolvedId });\n res.setHeader('Content-Type', 'text/javascript');\n res.setHeader('Cache-Control', 'no-cache');\n res.end('');\n return;\n }\n\n const result = fileEmitter(resolvedId);\n debugHmr('middleware: served component update', {\n resolvedId,\n hasCode: !!result?.hmrUpdateCode,\n });\n res.setHeader('Content-Type', 'text/javascript');\n res.setHeader('Cache-Control', 'no-cache');\n res.end(`${result?.hmrUpdateCode || ''}`);\n };\n\n server.middlewares.use(angularComponentMiddleware);\n },\n resolveId(id, _importer, options) {\n if (\n options?.ssr &&\n id.startsWith(FILE_PREFIX) &&\n id.includes(ANGULAR_COMPONENT_PREFIX)\n ) {\n return `\\0${id}`;\n }\n\n return undefined;\n },\n load(id, options) {\n if (options?.ssr && id.includes(ANGULAR_COMPONENT_PREFIX)) {\n const requestUrl = new URL(id.slice(1), 'http://localhost');\n const componentId = requestUrl.searchParams.get('c');\n\n if (!componentId) {\n return;\n }\n\n const result = fileEmitter(\n normalizePath(\n resolve(\n process.cwd(),\n decodeURIComponent(componentId).split('@')[0],\n ),\n ),\n );\n\n return result?.hmrUpdateCode || '';\n }\n\n return;\n },\n };\n}\n"],"mappings":";;;;AAOA,IAAM,2BAA2B;AACjC,IAAM,cAAc;AAEpB,SAAgB,iBAAiB,EAC/B,YACA,eAIS;AACT,QAAO;EACL,MAAM;EACN,OAAO;EACP,gBAAgB,QAAuB;GACrC,MAAM,6BAAqD,OACzD,KACA,KACA,SACG;AACH,QAAI,IAAI,QAAQ,KAAA,KAAa,IAAI,cAC/B;AAGF,QAAI,CAAC,IAAI,IAAI,SAAS,yBAAyB,EAAE;AAC/C,WAAM;AAEN;;IAIF,MAAM,cADa,IAAI,IAAI,IAAI,KAAK,mBAAmB,CACxB,aAAa,IAAI,IAAI;AAEpD,QAAI,CAAC,aAAa;AAChB,SAAI,aAAa;AACjB,SAAI,KAAK;AAET;;IAGF,MAAM,CAAC,UAAU,mBAAmB,YAAY,CAAC,MAAM,IAAI;IAC3D,MAAM,aAAa,cAAc,QAAQ,QAAQ,KAAK,EAAE,OAAO,CAAC;AAMhE,QAAI,EAJF,CAAC,CAAC,OAAO,YAAY,cAAc,WAAW,EAC1C,6BAA6B,WAAW,IAAI,WAAW,GAG3C;AAChB,cAAS,yCAAyC,EAAE,YAAY,CAAC;AACjE,SAAI,UAAU,gBAAgB,kBAAkB;AAChD,SAAI,UAAU,iBAAiB,WAAW;AAC1C,SAAI,IAAI,GAAG;AACX;;IAGF,MAAM,SAAS,YAAY,WAAW;AACtC,aAAS,uCAAuC;KAC9C;KACA,SAAS,CAAC,CAAC,QAAQ;KACpB,CAAC;AACF,QAAI,UAAU,gBAAgB,kBAAkB;AAChD,QAAI,UAAU,iBAAiB,WAAW;AAC1C,QAAI,IAAI,GAAG,QAAQ,iBAAiB,KAAK;;AAG3C,UAAO,YAAY,IAAI,2BAA2B;;EAEpD,UAAU,IAAI,WAAW,SAAS;AAChC,OACE,SAAS,OACT,GAAG,WAAW,YAAY,IAC1B,GAAG,SAAS,yBAAyB,CAErC,QAAO,KAAK;;EAKhB,KAAK,IAAI,SAAS;AAChB,OAAI,SAAS,OAAO,GAAG,SAAS,yBAAyB,EAAE;IAEzD,MAAM,cADa,IAAI,IAAI,GAAG,MAAM,EAAE,EAAE,mBAAmB,CAC5B,aAAa,IAAI,IAAI;AAEpD,QAAI,CAAC,YACH;AAYF,WATe,YACb,cACE,QACE,QAAQ,KAAK,EACb,mBAAmB,YAAY,CAAC,MAAM,IAAI,CAAC,GAC5C,CACF,CACF,EAEc,iBAAiB;;;EAKrC"}
1
+ {"version":3,"file":"live-reload-plugin.js","names":[],"sources":["../../../src/lib/live-reload-plugin.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { ServerResponse } from 'node:http';\nimport { Connect, normalizePath, Plugin, ViteDevServer } from 'vite';\n\nimport { EmitFileResult } from './models.js';\nimport { debugHmr } from './utils/debug.js';\n\nconst ANGULAR_COMPONENT_PREFIX = '/@ng/component';\nconst FILE_PREFIX = 'file:';\n\nexport function liveReloadPlugin({\n classNames,\n fileEmitter,\n}: {\n classNames: Map<string, string>;\n fileEmitter: (file: string) => EmitFileResult | undefined;\n}): Plugin {\n return {\n name: 'analogjs-live-reload-plugin',\n apply: 'serve',\n configureServer(server: ViteDevServer) {\n if (server.config.server.hmr === false) {\n debugHmr('middleware disabled: vite server.hmr is false');\n return;\n }\n\n const angularComponentMiddleware: Connect.HandleFunction = async (\n req: Connect.IncomingMessage,\n res: ServerResponse<Connect.IncomingMessage>,\n next: Connect.NextFunction,\n ) => {\n if (req.url === undefined || res.writableEnded) {\n return;\n }\n\n if (!req.url.includes(ANGULAR_COMPONENT_PREFIX)) {\n next();\n\n return;\n }\n\n const requestUrl = new URL(req.url, 'http://localhost');\n const componentId = requestUrl.searchParams.get('c');\n\n if (!componentId) {\n res.statusCode = 400;\n res.end();\n\n return;\n }\n\n const [fileId] = decodeURIComponent(componentId).split('@');\n const resolvedId = normalizePath(resolve(process.cwd(), fileId));\n const invalidated =\n !!server.moduleGraph.getModuleById(resolvedId)\n ?.lastInvalidationTimestamp && classNames.get(resolvedId);\n\n // don't send an HMR update until the file has been invalidated\n if (!invalidated) {\n debugHmr('middleware: skipped (not invalidated)', { resolvedId });\n res.setHeader('Content-Type', 'text/javascript');\n res.setHeader('Cache-Control', 'no-cache');\n res.end('');\n return;\n }\n\n const result = fileEmitter(resolvedId);\n debugHmr('middleware: served component update', {\n resolvedId,\n hasCode: !!result?.hmrUpdateCode,\n });\n res.setHeader('Content-Type', 'text/javascript');\n res.setHeader('Cache-Control', 'no-cache');\n res.end(`${result?.hmrUpdateCode || ''}`);\n };\n\n server.middlewares.use(angularComponentMiddleware);\n },\n resolveId(id, _importer, options) {\n if (\n options?.ssr &&\n id.startsWith(FILE_PREFIX) &&\n id.includes(ANGULAR_COMPONENT_PREFIX)\n ) {\n return `\\0${id}`;\n }\n\n return undefined;\n },\n load(id, options) {\n if (options?.ssr && id.includes(ANGULAR_COMPONENT_PREFIX)) {\n const requestUrl = new URL(id.slice(1), 'http://localhost');\n const componentId = requestUrl.searchParams.get('c');\n\n if (!componentId) {\n return;\n }\n\n const result = fileEmitter(\n normalizePath(\n resolve(\n process.cwd(),\n decodeURIComponent(componentId).split('@')[0],\n ),\n ),\n );\n\n return result?.hmrUpdateCode || '';\n }\n\n return;\n },\n };\n}\n"],"mappings":";;;;AAOA,IAAM,2BAA2B;AACjC,IAAM,cAAc;AAEpB,SAAgB,iBAAiB,EAC/B,YACA,eAIS;AACT,QAAO;EACL,MAAM;EACN,OAAO;EACP,gBAAgB,QAAuB;AACrC,OAAI,OAAO,OAAO,OAAO,QAAQ,OAAO;AACtC,aAAS,gDAAgD;AACzD;;GAGF,MAAM,6BAAqD,OACzD,KACA,KACA,SACG;AACH,QAAI,IAAI,QAAQ,KAAA,KAAa,IAAI,cAC/B;AAGF,QAAI,CAAC,IAAI,IAAI,SAAS,yBAAyB,EAAE;AAC/C,WAAM;AAEN;;IAIF,MAAM,cADa,IAAI,IAAI,IAAI,KAAK,mBAAmB,CACxB,aAAa,IAAI,IAAI;AAEpD,QAAI,CAAC,aAAa;AAChB,SAAI,aAAa;AACjB,SAAI,KAAK;AAET;;IAGF,MAAM,CAAC,UAAU,mBAAmB,YAAY,CAAC,MAAM,IAAI;IAC3D,MAAM,aAAa,cAAc,QAAQ,QAAQ,KAAK,EAAE,OAAO,CAAC;AAMhE,QAAI,EAJF,CAAC,CAAC,OAAO,YAAY,cAAc,WAAW,EAC1C,6BAA6B,WAAW,IAAI,WAAW,GAG3C;AAChB,cAAS,yCAAyC,EAAE,YAAY,CAAC;AACjE,SAAI,UAAU,gBAAgB,kBAAkB;AAChD,SAAI,UAAU,iBAAiB,WAAW;AAC1C,SAAI,IAAI,GAAG;AACX;;IAGF,MAAM,SAAS,YAAY,WAAW;AACtC,aAAS,uCAAuC;KAC9C;KACA,SAAS,CAAC,CAAC,QAAQ;KACpB,CAAC;AACF,QAAI,UAAU,gBAAgB,kBAAkB;AAChD,QAAI,UAAU,iBAAiB,WAAW;AAC1C,QAAI,IAAI,GAAG,QAAQ,iBAAiB,KAAK;;AAG3C,UAAO,YAAY,IAAI,2BAA2B;;EAEpD,UAAU,IAAI,WAAW,SAAS;AAChC,OACE,SAAS,OACT,GAAG,WAAW,YAAY,IAC1B,GAAG,SAAS,yBAAyB,CAErC,QAAO,KAAK;;EAKhB,KAAK,IAAI,SAAS;AAChB,OAAI,SAAS,OAAO,GAAG,SAAS,yBAAyB,EAAE;IAEzD,MAAM,cADa,IAAI,IAAI,GAAG,MAAM,EAAE,EAAE,mBAAmB,CAC5B,aAAa,IAAI,IAAI;AAEpD,QAAI,CAAC,YACH;AAYF,WATe,YACb,cACE,QACE,QAAQ,KAAK,EACb,mBAAmB,YAAY,CAAC,MAAM,IAAI,CAAC,GAC5C,CACF,CACF,EAEc,iBAAiB;;;EAKrC"}
@@ -0,0 +1,12 @@
1
+ export interface CssTailwindDirectiveState {
2
+ commentlessCode: string;
3
+ hasReferenceDirective: boolean;
4
+ hasReferenceText: boolean;
5
+ hasTailwindImportDirective: boolean;
6
+ }
7
+ export declare class TailwindReferenceError extends Error {
8
+ readonly name = "TailwindReferenceError";
9
+ }
10
+ export declare function inspectCssTailwindDirectives(code: string): CssTailwindDirectiveState;
11
+ export declare function throwTailwindReferenceTextError(filename: string, rootStylesheet: string): never;
12
+ export declare function isTailwindReferenceError(error: unknown): error is TailwindReferenceError;
@@ -0,0 +1,99 @@
1
+ //#region packages/vite-plugin-angular/src/lib/utils/tailwind-reference.ts
2
+ var ANGULAR_TAILWIND_PREFIX = "[@analogjs/vite-plugin-angular]";
3
+ var CSS_REFERENCE_DIRECTIVE_REGEX = /(^|[;}\n\r])\s*@reference\b/m;
4
+ var CSS_TAILWIND_IMPORT_REGEX = /(^|[;}\n\r])\s*@import\s+["']tailwindcss["']/m;
5
+ var TailwindReferenceError = class extends Error {
6
+ name = "TailwindReferenceError";
7
+ };
8
+ function stripCssBlockComments(code) {
9
+ let result = "";
10
+ let quote = null;
11
+ for (let index = 0; index < code.length; index++) {
12
+ const character = code[index];
13
+ const nextCharacter = code[index + 1];
14
+ if (quote) {
15
+ if (character === "\\" && nextCharacter) {
16
+ result += character;
17
+ result += nextCharacter;
18
+ index++;
19
+ continue;
20
+ }
21
+ if (character === quote) quote = null;
22
+ result += character;
23
+ continue;
24
+ }
25
+ if (character === "\"" || character === "'" || character === "`") {
26
+ quote = character;
27
+ result += character;
28
+ continue;
29
+ }
30
+ if (character === "/" && nextCharacter === "*") {
31
+ result += " ";
32
+ index += 2;
33
+ while (index < code.length) {
34
+ const commentCharacter = code[index];
35
+ const commentNextCharacter = code[index + 1];
36
+ if (commentCharacter === "*" && commentNextCharacter === "/") {
37
+ result += " ";
38
+ index++;
39
+ break;
40
+ }
41
+ result += commentCharacter === "\n" || commentCharacter === "\r" ? commentCharacter : " ";
42
+ index++;
43
+ }
44
+ continue;
45
+ }
46
+ result += character;
47
+ }
48
+ return result;
49
+ }
50
+ function hasReferenceTextInComments(code) {
51
+ let quote = null;
52
+ for (let index = 0; index < code.length; index++) {
53
+ const character = code[index];
54
+ const nextCharacter = code[index + 1];
55
+ if (quote) {
56
+ if (character === "\\" && nextCharacter) {
57
+ index++;
58
+ continue;
59
+ }
60
+ if (character === quote) quote = null;
61
+ continue;
62
+ }
63
+ if (character === "\"" || character === "'" || character === "`") {
64
+ quote = character;
65
+ continue;
66
+ }
67
+ if (character === "/" && nextCharacter === "*") {
68
+ const commentStart = index + 2;
69
+ index += 2;
70
+ while (index < code.length) {
71
+ const commentCharacter = code[index];
72
+ const commentNextCharacter = code[index + 1];
73
+ if (commentCharacter === "*" && commentNextCharacter === "/") break;
74
+ index++;
75
+ }
76
+ if (code.slice(commentStart, index).includes("@reference")) return true;
77
+ }
78
+ }
79
+ return false;
80
+ }
81
+ function inspectCssTailwindDirectives(code) {
82
+ const commentlessCode = stripCssBlockComments(code);
83
+ return {
84
+ commentlessCode,
85
+ hasReferenceDirective: CSS_REFERENCE_DIRECTIVE_REGEX.test(commentlessCode),
86
+ hasReferenceText: hasReferenceTextInComments(code),
87
+ hasTailwindImportDirective: CSS_TAILWIND_IMPORT_REGEX.test(commentlessCode)
88
+ };
89
+ }
90
+ function throwTailwindReferenceTextError(filename, rootStylesheet) {
91
+ throw new TailwindReferenceError(`${ANGULAR_TAILWIND_PREFIX} Tailwind @reference auto-injection was blocked for "${filename}" because the stylesheet contains the text "@reference" but does not contain a real @reference directive.\n\nThis is usually caused by a CSS comment such as "/* ... @reference ... */".\n\nFix one of:\n - Reword the comment so it does not contain "@reference"\n - Add a real @reference "${rootStylesheet}"; directive\n`);
92
+ }
93
+ function isTailwindReferenceError(error) {
94
+ return error instanceof TailwindReferenceError;
95
+ }
96
+ //#endregion
97
+ export { inspectCssTailwindDirectives, isTailwindReferenceError, throwTailwindReferenceTextError };
98
+
99
+ //# sourceMappingURL=tailwind-reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwind-reference.js","names":[],"sources":["../../../../src/lib/utils/tailwind-reference.ts"],"sourcesContent":["const ANGULAR_TAILWIND_PREFIX = '[@analogjs/vite-plugin-angular]';\nconst CSS_REFERENCE_DIRECTIVE_REGEX = /(^|[;}\\n\\r])\\s*@reference\\b/m;\nconst CSS_TAILWIND_IMPORT_REGEX =\n /(^|[;}\\n\\r])\\s*@import\\s+[\"']tailwindcss[\"']/m;\n\nexport interface CssTailwindDirectiveState {\n commentlessCode: string;\n hasReferenceDirective: boolean;\n hasReferenceText: boolean;\n hasTailwindImportDirective: boolean;\n}\n\nexport class TailwindReferenceError extends Error {\n readonly name = 'TailwindReferenceError';\n}\n\n// Match real CSS directives, not prose inside block comments. The scanner keeps\n// quoted CSS content intact so `/* ... */` sequences inside strings do not get\n// mistaken for real comments.\nfunction stripCssBlockComments(code: string): string {\n let result = '';\n let quote: '\"' | \"'\" | '`' | null = null;\n\n for (let index = 0; index < code.length; index++) {\n const character = code[index];\n const nextCharacter = code[index + 1];\n\n if (quote) {\n if (character === '\\\\' && nextCharacter) {\n result += character;\n result += nextCharacter;\n index++;\n continue;\n }\n if (character === quote) {\n quote = null;\n }\n result += character;\n continue;\n }\n\n if (character === '\"' || character === \"'\" || character === '`') {\n quote = character;\n result += character;\n continue;\n }\n\n if (character === '/' && nextCharacter === '*') {\n result += ' ';\n index += 2;\n\n while (index < code.length) {\n const commentCharacter = code[index];\n const commentNextCharacter = code[index + 1];\n\n if (commentCharacter === '*' && commentNextCharacter === '/') {\n result += ' ';\n index++;\n break;\n }\n\n result +=\n commentCharacter === '\\n' || commentCharacter === '\\r'\n ? commentCharacter\n : ' ';\n index++;\n }\n continue;\n }\n\n result += character;\n }\n\n return result;\n}\n\nfunction hasReferenceTextInComments(code: string): boolean {\n let quote: '\"' | \"'\" | '`' | null = null;\n\n for (let index = 0; index < code.length; index++) {\n const character = code[index];\n const nextCharacter = code[index + 1];\n\n if (quote) {\n if (character === '\\\\' && nextCharacter) {\n index++;\n continue;\n }\n if (character === quote) {\n quote = null;\n }\n continue;\n }\n\n if (character === '\"' || character === \"'\" || character === '`') {\n quote = character;\n continue;\n }\n\n if (character === '/' && nextCharacter === '*') {\n const commentStart = index + 2;\n index += 2;\n\n while (index < code.length) {\n const commentCharacter = code[index];\n const commentNextCharacter = code[index + 1];\n\n if (commentCharacter === '*' && commentNextCharacter === '/') {\n break;\n }\n index++;\n }\n\n if (code.slice(commentStart, index).includes('@reference')) {\n return true;\n }\n }\n }\n\n return false;\n}\n\nexport function inspectCssTailwindDirectives(\n code: string,\n): CssTailwindDirectiveState {\n const commentlessCode = stripCssBlockComments(code);\n\n return {\n commentlessCode,\n hasReferenceDirective: CSS_REFERENCE_DIRECTIVE_REGEX.test(commentlessCode),\n hasReferenceText: hasReferenceTextInComments(code),\n hasTailwindImportDirective: CSS_TAILWIND_IMPORT_REGEX.test(commentlessCode),\n };\n}\n\nexport function throwTailwindReferenceTextError(\n filename: string,\n rootStylesheet: string,\n): never {\n throw new TailwindReferenceError(\n `${ANGULAR_TAILWIND_PREFIX} Tailwind @reference auto-injection was ` +\n `blocked for \"${filename}\" because the stylesheet contains the ` +\n `text \"@reference\" but does not contain a real @reference ` +\n `directive.\\n\\n` +\n `This is usually caused by a CSS comment such as ` +\n `\"/* ... @reference ... */\".\\n\\n` +\n `Fix one of:\\n` +\n ` - Reword the comment so it does not contain \"@reference\"\\n` +\n ` - Add a real @reference \"${rootStylesheet}\"; directive\\n`,\n );\n}\n\nexport function isTailwindReferenceError(\n error: unknown,\n): error is TailwindReferenceError {\n return error instanceof TailwindReferenceError;\n}\n"],"mappings":";AAAA,IAAM,0BAA0B;AAChC,IAAM,gCAAgC;AACtC,IAAM,4BACJ;AASF,IAAa,yBAAb,cAA4C,MAAM;CAChD,OAAgB;;AAMlB,SAAS,sBAAsB,MAAsB;CACnD,IAAI,SAAS;CACb,IAAI,QAAgC;AAEpC,MAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS;EAChD,MAAM,YAAY,KAAK;EACvB,MAAM,gBAAgB,KAAK,QAAQ;AAEnC,MAAI,OAAO;AACT,OAAI,cAAc,QAAQ,eAAe;AACvC,cAAU;AACV,cAAU;AACV;AACA;;AAEF,OAAI,cAAc,MAChB,SAAQ;AAEV,aAAU;AACV;;AAGF,MAAI,cAAc,QAAO,cAAc,OAAO,cAAc,KAAK;AAC/D,WAAQ;AACR,aAAU;AACV;;AAGF,MAAI,cAAc,OAAO,kBAAkB,KAAK;AAC9C,aAAU;AACV,YAAS;AAET,UAAO,QAAQ,KAAK,QAAQ;IAC1B,MAAM,mBAAmB,KAAK;IAC9B,MAAM,uBAAuB,KAAK,QAAQ;AAE1C,QAAI,qBAAqB,OAAO,yBAAyB,KAAK;AAC5D,eAAU;AACV;AACA;;AAGF,cACE,qBAAqB,QAAQ,qBAAqB,OAC9C,mBACA;AACN;;AAEF;;AAGF,YAAU;;AAGZ,QAAO;;AAGT,SAAS,2BAA2B,MAAuB;CACzD,IAAI,QAAgC;AAEpC,MAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS;EAChD,MAAM,YAAY,KAA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