@reckona/mreact-router 0.0.150 → 0.0.152
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/README.md +1 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +60 -8
- package/dist/build.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/link.d.ts +17 -7
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js.map +1 -1
- package/dist/tailwind-source.d.ts +6 -0
- package/dist/tailwind-source.d.ts.map +1 -0
- package/dist/tailwind-source.js +25 -0
- package/dist/tailwind-source.js.map +1 -0
- package/dist/typed-routes.d.ts +6 -1
- package/dist/typed-routes.d.ts.map +1 -1
- package/dist/typed-routes.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +3 -25
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/build.ts +81 -10
- package/src/index.ts +9 -0
- package/src/link.ts +34 -11
- package/src/tailwind-source.ts +37 -0
- package/src/typed-routes.ts +22 -3
- package/src/vite.ts +3 -38
package/dist/index.d.ts
CHANGED
|
@@ -41,14 +41,14 @@ export declare const getSession: typeof getSessionInternal;
|
|
|
41
41
|
export declare const rotateSession: typeof rotateSessionInternal;
|
|
42
42
|
export type { AwsLambdaArtifactManifest, BuildAppPhase, BuildAppPhaseTiming, BuildAppOptions, BuildAppProgressEvent, BuildAppResult, BuiltImportPolicyArtifact, CloudflarePagesArtifactManifest, PackageAwsLambdaArtifactOptions, PackageCloudflarePagesArtifactOptions, } from "./build.js";
|
|
43
43
|
export type { ServerActionContext } from "./actions.js";
|
|
44
|
-
export type { AppRouteHref, DynamicHrefOptions, RouteParamsFor, RouteSearchParams, RouteSearchValue, StaticHrefOptions, } from "./typed-routes.js";
|
|
44
|
+
export type { AppRouteHref, AppRouteLinkHref, AppRouteLinkHrefSuffix, AppRouteLinkPathname, AppRouteLinkSegment, AppRouteLinkSegments, DynamicHrefOptions, RouteParamsFor, RouteSearchParams, RouteSearchValue, StaticHrefOptions, } from "./typed-routes.js";
|
|
45
45
|
export type { InferLoaderData, InferLoaderParams, LayoutProps, LoaderContext, GenerateMetadataContext, ManifestContext, ManifestDescriptor, MetadataImage, MetadataScalar, MetadataThemeColor, MetadataViewport, MReactNode, PageProps, PageComponent, RobotsContext, RobotsManifest, RobotsRule, RouteHeadDescriptor, RouteHandlerContext, RouteLoader, RouteMetadata, RouteParams, RouteSecurityHeaders, RouteStrictTransportSecurity, SitemapContext, SitemapEntry, } from "./types.js";
|
|
46
46
|
export type { AppRouterBuildTarget, AppRouterClientConsoleMethod, AppRouterClientSourceMapMode, AppRouterClientSourceMapOption, AppRouterProductionOptions, } from "./config.js";
|
|
47
47
|
export type { AssetHelperOptions, AssetLinkDescriptor, AssetManifest, AssetManifestEntry, } from "./assets.js";
|
|
48
48
|
export type { AppRouterCache, AppRouterCacheEntry, CacheControlOptions, MemoryRouteCacheOptions, RouteCachePolicy, } from "./cache.js";
|
|
49
49
|
export type { CookieOptions } from "./cookies.js";
|
|
50
50
|
export type { AppRouterImportPolicy } from "./import-policy.js";
|
|
51
|
-
export type { LinkChild, LinkOptions, LinkPrefetch, LinkProps, LinkScroll, LinkTransition, TrustedLinkHtml, } from "./link.js";
|
|
51
|
+
export type { AppRouteDeclarations, ConcreteLinkHrefGuard, LinkChild, LinkHref, LinkOptions, LinkPrefetch, LinkProps, RegisteredAppRoutePath, LinkScroll, LinkTransition, TrustedLinkHtml, } from "./link.js";
|
|
52
52
|
export type { AppRouterNavigationState, AppRouterNavigationStateListener, AppRouterNavigationType, } from "./navigation-state.js";
|
|
53
53
|
export type { RouterRuntimeCacheStat } from "./runtime-cache.js";
|
|
54
54
|
export type { MemorySessionStoreOptionsInternal as MemorySessionStoreOptions };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["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;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAC7C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AA+GnD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAkBnB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAM/C,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAiBpB,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AASxF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { buildApp, packageAwsLambdaArtifact, packageCloudflarePagesArtifact } from \"./build.js\";\nexport { assetHref, assetPreloadLinks } from \"./assets.js\";\nexport { cacheControl, createMemoryRouteCache, revalidatePath } from \"./cache.js\";\nexport { deleteCookie, parseCookieHeader, serializeCookie, setCookie } from \"./cookies.js\";\nexport { defineMessages, detectLocale } from \"./i18n.js\";\nexport { defer, isDeferredLoaderData } from \"./deferred.js\";\nexport type { DeferredLoaderData } from \"./deferred.js\";\nexport { definePage } from \"./types.js\";\nexport { Link, linkProps } from \"./link.js\";\nexport { href } from \"./typed-routes.js\";\nexport { parseMultipartStream } from \"./multipart.js\";\nexport type {\n MultipartFixedLengthStream,\n MultipartStreamFieldOptions,\n MultipartStreamParseOptions,\n MultipartStreamPart,\n} from \"./multipart.js\";\nexport { getNavigationState, subscribeNavigationState } from \"./navigation-state.js\";\nexport { getRouterRuntimeCacheStats } from \"./runtime-cache.js\";\nexport type { HttpUpgradeHandler } from \"./upgrade.js\";\nexport {\n cookies,\n headers,\n html,\n isNotFoundError,\n isRedirectError,\n json,\n next,\n notFound,\n parseForm,\n redirect,\n redirect303,\n redirectExternal,\n rewrite,\n textError,\n throwNotFound,\n} from \"./navigation.js\";\nexport type { ParseSchema } from \"./navigation.js\";\nexport { createMemoryPrerenderStore } from \"./prerender-store.js\";\nexport { getServerRuntimeState } from \"./runtime-state.js\";\nimport {\n createMemorySessionStore as createMemorySessionStoreInternal,\n createSession as createSessionInternal,\n destroySession as destroySessionInternal,\n getSession as getSessionInternal,\n rotateSession as rotateSessionInternal,\n} from \"./session.js\";\nimport type {\n MemorySessionStoreOptions as MemorySessionStoreOptionsInternal,\n SessionCookieOptions as SessionCookieOptionsInternal,\n SessionRecord as SessionRecordInternal,\n SessionStore as SessionStoreInternal,\n} from \"./session.js\";\n\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createMemorySessionStore = createMemorySessionStoreInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createSession = createSessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const destroySession = destroySessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const getSession = getSessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const rotateSession = rotateSessionInternal;\nexport type {\n AwsLambdaArtifactManifest,\n BuildAppPhase,\n BuildAppPhaseTiming,\n BuildAppOptions,\n BuildAppProgressEvent,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n CloudflarePagesArtifactManifest,\n PackageAwsLambdaArtifactOptions,\n PackageCloudflarePagesArtifactOptions,\n} from \"./build.js\";\nexport type { ServerActionContext } from \"./actions.js\";\nexport type {\n AppRouteHref,\n AppRouteLinkHref,\n AppRouteLinkHrefSuffix,\n AppRouteLinkPathname,\n AppRouteLinkSegment,\n AppRouteLinkSegments,\n DynamicHrefOptions,\n RouteParamsFor,\n RouteSearchParams,\n RouteSearchValue,\n StaticHrefOptions,\n} from \"./typed-routes.js\";\nexport type {\n InferLoaderData,\n InferLoaderParams,\n LayoutProps,\n LoaderContext,\n GenerateMetadataContext,\n ManifestContext,\n ManifestDescriptor,\n MetadataImage,\n MetadataScalar,\n MetadataThemeColor,\n MetadataViewport,\n MReactNode,\n PageProps,\n PageComponent,\n RobotsContext,\n RobotsManifest,\n RobotsRule,\n RouteHeadDescriptor,\n RouteHandlerContext,\n RouteLoader,\n RouteMetadata,\n RouteParams,\n RouteSecurityHeaders,\n RouteStrictTransportSecurity,\n SitemapContext,\n SitemapEntry,\n} from \"./types.js\";\nexport type {\n AppRouterBuildTarget,\n AppRouterClientConsoleMethod,\n AppRouterClientSourceMapMode,\n AppRouterClientSourceMapOption,\n AppRouterProductionOptions,\n} from \"./config.js\";\nexport type {\n AssetHelperOptions,\n AssetLinkDescriptor,\n AssetManifest,\n AssetManifestEntry,\n} from \"./assets.js\";\nexport type {\n AppRouterCache,\n AppRouterCacheEntry,\n CacheControlOptions,\n MemoryRouteCacheOptions,\n RouteCachePolicy,\n} from \"./cache.js\";\nexport type { CookieOptions } from \"./cookies.js\";\nexport type { AppRouterImportPolicy } from \"./import-policy.js\";\nexport type {\n AppRouteDeclarations,\n ConcreteLinkHrefGuard,\n LinkChild,\n LinkHref,\n LinkOptions,\n LinkPrefetch,\n LinkProps,\n RegisteredAppRoutePath,\n LinkScroll,\n LinkTransition,\n TrustedLinkHtml,\n} from \"./link.js\";\nexport type {\n AppRouterNavigationState,\n AppRouterNavigationStateListener,\n AppRouterNavigationType,\n} from \"./navigation-state.js\";\nexport type { RouterRuntimeCacheStat } from \"./runtime-cache.js\";\nexport type { MemorySessionStoreOptionsInternal as MemorySessionStoreOptions };\nexport type {\n AppRouterCspInlineNonceWarningLogEvent,\n AppRouterLogError,\n AppRouterLogEvent,\n AppRouterLogger,\n AppRouterLogLevel,\n AppRouterRuntime,\n AppRouterRequestEndLogEvent,\n AppRouterRequestErrorLogEvent,\n AppRouterRenderTimingLogEvent,\n AppRouterRequestStartLogEvent,\n AppRouterRequestTimingLogEvent,\n} from \"./logger.js\";\nexport type { DetectedLocale, LocaleRoutingOptions, MessageTree } from \"./i18n.js\";\nexport {\n createFormCsrfToken,\n formCsrfCookie,\n formCsrfFieldName,\n validateFormCsrf,\n} from \"./csrf.js\";\nexport type {\n AppRouterAllowedServerAction,\n AppRouterServerActionOptions,\n PreparedFormActionReference,\n} from \"./actions.js\";\n/**\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionCookieOptions = SessionCookieOptionsInternal;\n/**\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionRecord<TData = unknown> = SessionRecordInternal<TData>;\n/**\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionStore<TData = unknown> = SessionStoreInternal<TData>;\nexport { startDevServer } from \"./dev-server.js\";\nexport type { StartDevServerOptions } from \"./dev-server.js\";\nexport { renderAppRequest } from \"./render.js\";\nexport type {\n AppRouterResponseHook,\n AppRouterResponseHookContext,\n RenderAppRequestOptions,\n} from \"./render.js\";\nexport {\n parseTraceContext,\n traceContextFromRequest,\n} from \"./trace.js\";\nexport type {\n RouterInstrumentation,\n RouterMiddlewareEndInstrumentationEvent,\n RouterMiddlewareInstrumentationEvent,\n RouterRequestEndInstrumentationEvent,\n RouterRequestInstrumentationEvent,\n RouterRouteEndInstrumentationEvent,\n RouterRouteInstrumentationEvent,\n RouterTraceContext,\n} from \"./trace.js\";\nexport type {\n FileSystemPrerenderStoreOptions,\n KeyValuePrerenderStoreAdapter,\n KeyValuePrerenderStoreOptions,\n MemoryPrerenderStoreOptions,\n} from \"./prerender-store.js\";\nexport { createFileSystemPrerenderStore, createKeyValuePrerenderStore } from \"./prerender-store.js\";\nexport { preloadBuiltAppRuntime, renderBuiltAppRequest, startServer } from \"./serve.js\";\nexport type {\n BuiltAppRuntimePreloadMode,\n AppRouterPrerenderStore,\n BuiltAppRuntimePreloadStrategy,\n RenderBuiltAppRequestOptions,\n RequestHostPolicy,\n StartServerOptions,\n} from \"./serve.js\";\nexport { matchRoute, scanAppRoutes } from \"./routes.js\";\nexport type { AppFileConvention } from \"./file-conventions.js\";\nexport type {\n AppAssetRoute,\n AppMetadataRoute,\n AppRoute,\n MatchedRoute,\n PageRoute,\n RouteSegment,\n ServerRoute,\n} from \"./routes.js\";\n"]}
|
package/dist/link.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { HtmlSink } from "@reckona/mreact-shared/compiler-contract";
|
|
2
2
|
import type { ReactCompatElement, ReactCompatNode } from "@reckona/mreact-compat";
|
|
3
|
+
import type { AppRouteLinkHref } from "./typed-routes.js";
|
|
4
|
+
export type { AppRouteLinkHref, AppRouteLinkHrefSuffix, AppRouteLinkPathname, AppRouteLinkSegment, AppRouteLinkSegments, } from "./typed-routes.js";
|
|
3
5
|
declare const TRUSTED_LINK_HTML: unique symbol;
|
|
4
6
|
export type LinkPrefetch = "intent" | "viewport" | "none" | false;
|
|
5
7
|
export type LinkScroll = "top" | "preserve";
|
|
@@ -8,19 +10,27 @@ export type TrustedLinkHtml = {
|
|
|
8
10
|
readonly [TRUSTED_LINK_HTML]: string;
|
|
9
11
|
};
|
|
10
12
|
export type LinkChild = ReactCompatNode | Node | TrustedLinkHtml | readonly LinkChild[];
|
|
11
|
-
export interface
|
|
12
|
-
|
|
13
|
+
export interface AppRouteDeclarations {
|
|
14
|
+
}
|
|
15
|
+
export type RegisteredAppRoutePath = AppRouteDeclarations extends {
|
|
16
|
+
readonly path: infer Path;
|
|
17
|
+
} ? Extract<Path, `/${string}`> : never;
|
|
18
|
+
export type LinkHref = [RegisteredAppRoutePath] extends [never] ? string : AppRouteLinkHref<RegisteredAppRoutePath>;
|
|
19
|
+
export interface LinkOptions<Href extends string = LinkHref> {
|
|
20
|
+
href: Href;
|
|
13
21
|
prefetch?: LinkPrefetch | undefined;
|
|
14
22
|
reload?: boolean | undefined;
|
|
15
23
|
scroll?: LinkScroll | undefined;
|
|
16
24
|
transition?: LinkTransition | undefined;
|
|
17
25
|
}
|
|
18
|
-
export interface LinkProps extends LinkOptions {
|
|
26
|
+
export interface LinkProps<Href extends string = LinkHref> extends LinkOptions<Href> {
|
|
19
27
|
children?: LinkChild;
|
|
20
28
|
[attribute: string]: unknown;
|
|
21
29
|
}
|
|
22
|
-
export declare function linkProps(options: LinkOptions): Record<string, string>;
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
export declare function linkProps(options: LinkOptions<string>): Record<string, string>;
|
|
31
|
+
export type ConcreteLinkHrefGuard<Href extends string> = [RegisteredAppRoutePath] extends [never] ? unknown : Href extends Extract<RegisteredAppRoutePath, `${string}:${string}`> ? {
|
|
32
|
+
readonly __mreactRoutePatternHrefError__: never;
|
|
33
|
+
} : unknown;
|
|
34
|
+
export declare function Link<const Href extends LinkHref>(props: LinkProps<Href> & ConcreteLinkHrefGuard<Href>): ReactCompatElement;
|
|
35
|
+
export declare function Link(sink: HtmlSink, props: LinkProps<string>): void;
|
|
26
36
|
//# sourceMappingURL=link.d.ts.map
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,YAAY,EACV,gBAAgB,EAChB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iBAAiB,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,iBAAiB,IAAI,KAAK;QAC1B,OAAQ,KAAyB,CAAC,iBAAiB,CAAC,KAAK,QAAQ,CAClE,CAAC;AACJ,CAAC","sourcesContent":["import { escapeHtmlAttribute, escapeHtmlText } from \"@reckona/mreact-shared/html-escape\";\nimport type { HtmlSink } from \"@reckona/mreact-shared/compiler-contract\";\nimport type { ReactCompatElement, ReactCompatNode } from \"@reckona/mreact-compat\";\nimport { safeUrlAttributeValue } from \"@reckona/mreact-shared/url-safety\";\n\nconst TRUSTED_LINK_HTML = Symbol.for(\"modular.react.router.trusted_link_html\");\n\nexport type LinkPrefetch = \"intent\" | \"viewport\" | \"none\" | false;\nexport type LinkScroll = \"top\" | \"preserve\";\nexport type LinkTransition = \"auto\" | \"none\" | false;\nexport type TrustedLinkHtml = { readonly [TRUSTED_LINK_HTML]: string };\nexport type LinkChild = ReactCompatNode | Node | TrustedLinkHtml | readonly LinkChild[];\n\nexport interface LinkOptions {\n href: string;\n prefetch?: LinkPrefetch | undefined;\n reload?: boolean | undefined;\n scroll?: LinkScroll | undefined;\n transition?: LinkTransition | undefined;\n}\n\nexport interface LinkProps extends LinkOptions {\n children?: LinkChild;\n [attribute: string]: unknown;\n}\n\nexport function linkProps(options: LinkOptions): Record<string, string> {\n return {\n href: options.href,\n ...(options.prefetch === undefined || options.prefetch === \"intent\"\n ? {}\n : { \"data-mreact-prefetch\": options.prefetch === false ? \"none\" : options.prefetch }),\n ...(options.reload === true ? { \"data-mreact-reload\": \"true\" } : {}),\n ...(options.scroll === undefined || options.scroll === \"top\"\n ? {}\n : { \"data-mreact-scroll\": options.scroll }),\n ...(options.transition === undefined || options.transition === false || options.transition === \"none\"\n ? {}\n : { \"data-mreact-transition\": options.transition }),\n };\n}\n\nexport function Link(props: LinkProps): ReactCompatElement;\nexport function Link(sink: HtmlSink, props: LinkProps): void;\nexport function Link(\n sinkOrProps: HtmlSink | LinkProps,\n maybeProps?: LinkProps,\n): ReactCompatElement | string | HTMLAnchorElement | void {\n if (maybeProps !== undefined) {\n (sinkOrProps as HtmlSink).append(renderLinkString(maybeProps));\n return;\n }\n\n return renderLink(sinkOrProps as LinkProps);\n}\n\n(Link as typeof Link & { trustedHtml(html: string): TrustedLinkHtml }).trustedHtml = (\n html: string,\n): TrustedLinkHtml => ({\n [TRUSTED_LINK_HTML]: html,\n});\n\nfunction renderLink(props: LinkProps): string | HTMLAnchorElement {\n const { href, prefetch, reload, scroll, transition, ...rest } = props;\n const propsWithLinkAttrs = {\n ...rest,\n ...linkProps({ href, prefetch, reload, scroll, transition }),\n };\n\n if (typeof document !== \"undefined\" && typeof document.createElement === \"function\") {\n return createAnchorElement(propsWithLinkAttrs);\n }\n\n return renderAnchorString(propsWithLinkAttrs);\n}\n\nfunction renderLinkString(props: LinkProps): string {\n const { href, prefetch, reload, scroll, transition, ...rest } = props;\n\n return renderAnchorString({\n ...rest,\n ...linkProps({ href, prefetch, reload, scroll, transition }),\n });\n}\n\nfunction createAnchorElement(props: Record<string, unknown>): HTMLAnchorElement {\n const anchor = document.createElement(\"a\");\n\n for (const [name, value] of Object.entries(props)) {\n if (name === \"children\") {\n appendLinkChild(anchor, value as LinkChild);\n continue;\n }\n\n if (!shouldSetAttribute(name, value)) {\n continue;\n }\n\n const attrName = attributeName(name);\n const safeValue = safeUrlAttributeValue(attrName, String(value));\n\n if (safeValue === undefined) {\n continue;\n }\n\n anchor.setAttribute(attrName, safeValue);\n }\n\n return anchor;\n}\n\nfunction appendLinkChild(parent: Node, child: LinkChild): void {\n if (child === null || child === undefined || typeof child === \"boolean\") {\n return;\n }\n\n if (Array.isArray(child)) {\n for (const item of child) {\n appendLinkChild(parent, item);\n }\n return;\n }\n\n if (child instanceof Node) {\n parent.appendChild(child);\n return;\n }\n\n parent.appendChild(document.createTextNode(String(child)));\n}\n\nfunction renderAnchorString(props: Record<string, unknown>): string {\n return `<a${renderAnchorAttributes(props)}>${renderChildren(props.children as LinkChild)}</a>`;\n}\n\nfunction renderAnchorAttributes(props: Record<string, unknown>): string {\n const attrs: string[] = [];\n\n for (const [name, value] of Object.entries(props)) {\n if (name === \"children\" || !shouldSetAttribute(name, value)) {\n continue;\n }\n\n const attrName = attributeName(name);\n const attrValue = String(value);\n const safeValue = safeUrlAttributeValue(attrName, attrValue);\n\n if (safeValue === undefined) {\n continue;\n }\n\n attrs.push(`${escapeHtmlAttribute(attrName)}=\"${escapeHtmlAttribute(safeValue)}\"`);\n }\n\n return attrs.length === 0 ? \"\" : ` ${attrs.join(\" \")}`;\n}\n\nfunction shouldSetAttribute(name: string, value: unknown): boolean {\n return (\n name !== \"key\" &&\n name !== \"ref\" &&\n value !== null &&\n value !== undefined &&\n value !== false &&\n typeof value !== \"function\" &&\n typeof value !== \"symbol\"\n );\n}\n\nfunction attributeName(name: string): string {\n return name === \"className\" ? \"class\" : name;\n}\n\nfunction renderChildren(child: LinkChild): string {\n if (child === null || child === undefined || typeof child === \"boolean\") {\n return \"\";\n }\n\n if (Array.isArray(child)) {\n return child.map(renderChildren).join(\"\");\n }\n\n if (isTrustedLinkHtml(child)) {\n return child[TRUSTED_LINK_HTML];\n }\n\n return escapeHtmlText(child);\n}\n\nfunction isTrustedLinkHtml(value: unknown): value is TrustedLinkHtml {\n return (\n typeof value === \"object\" &&\n value !== null &&\n TRUSTED_LINK_HTML in value &&\n typeof (value as TrustedLinkHtml)[TRUSTED_LINK_HTML] === \"string\"\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC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C;QACxE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,iBAAiB,IAAI,KAAK;QAC1B,OAAQ,KAAyB,CAAC,iBAAiB,CAAC,KAAK,QAAQ,CAClE,CAAC;AACJ,CAAC","sourcesContent":["import { escapeHtmlAttribute, escapeHtmlText } from \"@reckona/mreact-shared/html-escape\";\nimport type { HtmlSink } from \"@reckona/mreact-shared/compiler-contract\";\nimport type { ReactCompatElement, ReactCompatNode } from \"@reckona/mreact-compat\";\nimport { safeUrlAttributeValue } from \"@reckona/mreact-shared/url-safety\";\nimport type { AppRouteLinkHref } from \"./typed-routes.js\";\nexport type {\n AppRouteLinkHref,\n AppRouteLinkHrefSuffix,\n AppRouteLinkPathname,\n AppRouteLinkSegment,\n AppRouteLinkSegments,\n} from \"./typed-routes.js\";\n\nconst TRUSTED_LINK_HTML = Symbol.for(\"modular.react.router.trusted_link_html\");\n\nexport type LinkPrefetch = \"intent\" | \"viewport\" | \"none\" | false;\nexport type LinkScroll = \"top\" | \"preserve\";\nexport type LinkTransition = \"auto\" | \"none\" | false;\nexport type TrustedLinkHtml = { readonly [TRUSTED_LINK_HTML]: string };\nexport type LinkChild = ReactCompatNode | Node | TrustedLinkHtml | readonly LinkChild[];\nexport interface AppRouteDeclarations {}\nexport type RegisteredAppRoutePath = AppRouteDeclarations extends { readonly path: infer Path }\n ? Extract<Path, `/${string}`>\n : never;\nexport type LinkHref = [RegisteredAppRoutePath] extends [never]\n ? string\n : AppRouteLinkHref<RegisteredAppRoutePath>;\n\nexport interface LinkOptions<Href extends string = LinkHref> {\n href: Href;\n prefetch?: LinkPrefetch | undefined;\n reload?: boolean | undefined;\n scroll?: LinkScroll | undefined;\n transition?: LinkTransition | undefined;\n}\n\nexport interface LinkProps<Href extends string = LinkHref> extends LinkOptions<Href> {\n children?: LinkChild;\n [attribute: string]: unknown;\n}\n\nexport function linkProps(options: LinkOptions<string>): Record<string, string> {\n return {\n href: options.href,\n ...(options.prefetch === undefined || options.prefetch === \"intent\"\n ? {}\n : { \"data-mreact-prefetch\": options.prefetch === false ? \"none\" : options.prefetch }),\n ...(options.reload === true ? { \"data-mreact-reload\": \"true\" } : {}),\n ...(options.scroll === undefined || options.scroll === \"top\"\n ? {}\n : { \"data-mreact-scroll\": options.scroll }),\n ...(options.transition === undefined || options.transition === false || options.transition === \"none\"\n ? {}\n : { \"data-mreact-transition\": options.transition }),\n };\n}\n\nexport type ConcreteLinkHrefGuard<Href extends string> = [RegisteredAppRoutePath] extends [never]\n ? unknown\n : Href extends Extract<RegisteredAppRoutePath, `${string}:${string}`>\n ? { readonly __mreactRoutePatternHrefError__: never }\n : unknown;\n\nexport function Link<const Href extends LinkHref>(\n props: LinkProps<Href> & ConcreteLinkHrefGuard<Href>,\n): ReactCompatElement;\nexport function Link(sink: HtmlSink, props: LinkProps<string>): void;\nexport function Link(\n sinkOrProps: HtmlSink | LinkProps<string>,\n maybeProps?: LinkProps<string>,\n): ReactCompatElement | string | HTMLAnchorElement | void {\n if (maybeProps !== undefined) {\n (sinkOrProps as HtmlSink).append(renderLinkString(maybeProps));\n return;\n }\n\n return renderLink(sinkOrProps as LinkProps);\n}\n\n(Link as typeof Link & { trustedHtml(html: string): TrustedLinkHtml }).trustedHtml = (\n html: string,\n): TrustedLinkHtml => ({\n [TRUSTED_LINK_HTML]: html,\n});\n\nfunction renderLink(props: LinkProps<string>): string | HTMLAnchorElement {\n const { href, prefetch, reload, scroll, transition, ...rest } = props;\n const propsWithLinkAttrs = {\n ...rest,\n ...linkProps({ href, prefetch, reload, scroll, transition }),\n };\n\n if (typeof document !== \"undefined\" && typeof document.createElement === \"function\") {\n return createAnchorElement(propsWithLinkAttrs);\n }\n\n return renderAnchorString(propsWithLinkAttrs);\n}\n\nfunction renderLinkString(props: LinkProps<string>): string {\n const { href, prefetch, reload, scroll, transition, ...rest } = props;\n\n return renderAnchorString({\n ...rest,\n ...linkProps({ href, prefetch, reload, scroll, transition }),\n });\n}\n\nfunction createAnchorElement(props: Record<string, unknown>): HTMLAnchorElement {\n const anchor = document.createElement(\"a\");\n\n for (const [name, value] of Object.entries(props)) {\n if (name === \"children\") {\n appendLinkChild(anchor, value as LinkChild);\n continue;\n }\n\n if (!shouldSetAttribute(name, value)) {\n continue;\n }\n\n const attrName = attributeName(name);\n const safeValue = safeUrlAttributeValue(attrName, String(value));\n\n if (safeValue === undefined) {\n continue;\n }\n\n anchor.setAttribute(attrName, safeValue);\n }\n\n return anchor;\n}\n\nfunction appendLinkChild(parent: Node, child: LinkChild): void {\n if (child === null || child === undefined || typeof child === \"boolean\") {\n return;\n }\n\n if (Array.isArray(child)) {\n for (const item of child) {\n appendLinkChild(parent, item);\n }\n return;\n }\n\n if (child instanceof Node) {\n parent.appendChild(child);\n return;\n }\n\n parent.appendChild(document.createTextNode(String(child)));\n}\n\nfunction renderAnchorString(props: Record<string, unknown>): string {\n return `<a${renderAnchorAttributes(props)}>${renderChildren(props.children as LinkChild)}</a>`;\n}\n\nfunction renderAnchorAttributes(props: Record<string, unknown>): string {\n const attrs: string[] = [];\n\n for (const [name, value] of Object.entries(props)) {\n if (name === \"children\" || !shouldSetAttribute(name, value)) {\n continue;\n }\n\n const attrName = attributeName(name);\n const attrValue = String(value);\n const safeValue = safeUrlAttributeValue(attrName, attrValue);\n\n if (safeValue === undefined) {\n continue;\n }\n\n attrs.push(`${escapeHtmlAttribute(attrName)}=\"${escapeHtmlAttribute(safeValue)}\"`);\n }\n\n return attrs.length === 0 ? \"\" : ` ${attrs.join(\" \")}`;\n}\n\nfunction shouldSetAttribute(name: string, value: unknown): boolean {\n return (\n name !== \"key\" &&\n name !== \"ref\" &&\n value !== null &&\n value !== undefined &&\n value !== false &&\n typeof value !== \"function\" &&\n typeof value !== \"symbol\"\n );\n}\n\nfunction attributeName(name: string): string {\n return name === \"className\" ? \"class\" : name;\n}\n\nfunction renderChildren(child: LinkChild): string {\n if (child === null || child === undefined || typeof child === \"boolean\") {\n return \"\";\n }\n\n if (Array.isArray(child)) {\n return child.map(renderChildren).join(\"\");\n }\n\n if (isTrustedLinkHtml(child)) {\n return child[TRUSTED_LINK_HTML];\n }\n\n return escapeHtmlText(child);\n}\n\nfunction isTrustedLinkHtml(value: unknown): value is TrustedLinkHtml {\n return (\n typeof value === \"object\" &&\n value !== null &&\n TRUSTED_LINK_HTML in value &&\n typeof (value as TrustedLinkHtml)[TRUSTED_LINK_HTML] === \"string\"\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind-source.d.ts","sourceRoot":"","sources":["../src/tailwind-source.ts"],"names":[],"mappings":"AAEA,wBAAgB,+BAA+B,CAAC,OAAO,EAAE;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B,GAAG,MAAM,CAWT"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { dirname, relative, sep } from "node:path";
|
|
2
|
+
export function prependTailwindSourceDirectives(options) {
|
|
3
|
+
if (!isTailwindCssEntry(options.code)) {
|
|
4
|
+
return options.code;
|
|
5
|
+
}
|
|
6
|
+
const cssDir = dirname(options.cssFile);
|
|
7
|
+
const directives = [...new Set(options.sourceDirs)]
|
|
8
|
+
.map((sourceDir) => `${tailwindSourceDirective(cssDir, sourceDir)}\n`)
|
|
9
|
+
.join("");
|
|
10
|
+
return directives.length === 0 ? options.code : `${directives}${options.code}`;
|
|
11
|
+
}
|
|
12
|
+
function isTailwindCssEntry(code) {
|
|
13
|
+
return (/@import\s+(?:url\()?["']tailwindcss(?:\/[^"']*)?["']\)?/u.test(code) ||
|
|
14
|
+
/@tailwind\s+(?:base|components|utilities)\b/u.test(code));
|
|
15
|
+
}
|
|
16
|
+
function tailwindSourceDirective(cssDir, sourceDir) {
|
|
17
|
+
const relativeSourceDir = relative(cssDir, sourceDir).split(sep).join("/");
|
|
18
|
+
const normalizedSourceDir = relativeSourceDir === ""
|
|
19
|
+
? "."
|
|
20
|
+
: relativeSourceDir.startsWith(".")
|
|
21
|
+
? relativeSourceDir
|
|
22
|
+
: `./${relativeSourceDir}`;
|
|
23
|
+
return `@source ${JSON.stringify(`${normalizedSourceDir}/**/*.{js,jsx,ts,tsx,mdx}`)};`;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=tailwind-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind-source.js","sourceRoot":"","sources":["../src/tailwind-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,UAAU,+BAA+B,CAAC,OAI/C;IACC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO,OAAO,CAAC,IAAI,CAAC;IACtB,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;SAChD,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,uBAAuB,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC;SACrE,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AACjF,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO,CACL,0DAA0D,CAAC,IAAI,CAAC,IAAI,CAAC;QACrE,8CAA8C,CAAC,IAAI,CAAC,IAAI,CAAC,CAC1D,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAc,EAAE,SAAiB;IAChE,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3E,MAAM,mBAAmB,GACvB,iBAAiB,KAAK,EAAE;QACtB,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,GAAG,CAAC;YACjC,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,KAAK,iBAAiB,EAAE,CAAC;IAEjC,OAAO,WAAW,IAAI,CAAC,SAAS,CAAC,GAAG,mBAAmB,2BAA2B,CAAC,GAAG,CAAC;AACzF,CAAC","sourcesContent":["import { dirname, relative, sep } from \"node:path\";\n\nexport function prependTailwindSourceDirectives(options: {\n code: string;\n cssFile: string;\n sourceDirs: readonly string[];\n}): string {\n if (!isTailwindCssEntry(options.code)) {\n return options.code;\n }\n\n const cssDir = dirname(options.cssFile);\n const directives = [...new Set(options.sourceDirs)]\n .map((sourceDir) => `${tailwindSourceDirective(cssDir, sourceDir)}\\n`)\n .join(\"\");\n\n return directives.length === 0 ? options.code : `${directives}${options.code}`;\n}\n\nfunction isTailwindCssEntry(code: string): boolean {\n return (\n /@import\\s+(?:url\\()?[\"']tailwindcss(?:\\/[^\"']*)?[\"']\\)?/u.test(code) ||\n /@tailwind\\s+(?:base|components|utilities)\\b/u.test(code)\n );\n}\n\nfunction tailwindSourceDirective(cssDir: string, sourceDir: string): string {\n const relativeSourceDir = relative(cssDir, sourceDir).split(sep).join(\"/\");\n const normalizedSourceDir =\n relativeSourceDir === \"\"\n ? \".\"\n : relativeSourceDir.startsWith(\".\")\n ? relativeSourceDir\n : `./${relativeSourceDir}`;\n\n return `@source ${JSON.stringify(`${normalizedSourceDir}/**/*.{js,jsx,ts,tsx,mdx}`)};`;\n}\n"]}
|
package/dist/typed-routes.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export type RouteSearchValue = boolean | number | string | null | undefined;
|
|
2
2
|
export type RouteSearchParams = Record<string, RouteSearchValue | readonly RouteSearchValue[]>;
|
|
3
3
|
export type RouteParamsFor<Path extends `/${string}`> = Simplify<ExtractRouteParams<Path>>;
|
|
4
|
-
export type AppRouteHref<Path extends `/${string}`> =
|
|
4
|
+
export type AppRouteHref<Path extends `/${string}`> = keyof RouteParamsFor<Path> extends never ? (options?: StaticHrefOptions) => string : (options: DynamicHrefOptions<Path>) => string;
|
|
5
|
+
export type AppRouteLinkHref<Path extends `/${string}`> = `${AppRouteLinkPathname<Path>}${AppRouteLinkHrefSuffix}`;
|
|
5
6
|
export interface StaticHrefOptions {
|
|
6
7
|
hash?: string | undefined;
|
|
7
8
|
search?: RouteSearchParams | undefined;
|
|
@@ -19,6 +20,10 @@ type SegmentRouteParam<Segment extends string> = Segment extends `:...${infer Na
|
|
|
19
20
|
type Simplify<T> = {
|
|
20
21
|
[Key in keyof T]: T[Key];
|
|
21
22
|
} & {};
|
|
23
|
+
export type AppRouteLinkHrefSuffix = "" | `?${string}` | `#${string}` | `?${string}#${string}`;
|
|
24
|
+
export type AppRouteLinkPathname<Path extends `/${string}`> = Path extends "/" ? "/" : Path extends `/${infer Segments}` ? `/${AppRouteLinkSegments<Segments>}` : never;
|
|
25
|
+
export type AppRouteLinkSegments<Segments extends string> = Segments extends `${infer Segment}/${infer Rest}` ? `${AppRouteLinkSegment<Segment>}/${AppRouteLinkSegments<Rest>}` : AppRouteLinkSegment<Segments>;
|
|
26
|
+
export type AppRouteLinkSegment<Segment extends string> = Segment extends `:${string}` ? string : Segment;
|
|
22
27
|
export declare function href<const Path extends `/${string}`>(path: Path, ...args: HasRouteParams<Path> extends true ? [options: DynamicHrefOptions<Path>] : [options?: StaticHrefOptions]): string;
|
|
23
28
|
export {};
|
|
24
29
|
//# sourceMappingURL=typed-routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-routes.d.ts","sourceRoot":"","sources":["../src/typed-routes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAC5E,MAAM,MAAM,iBAAiB,GAAG,MAAM,CACpC,MAAM,EACN,gBAAgB,GAAG,SAAS,gBAAgB,EAAE,CAC/C,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,IAAI,MAAM,EAAE,IAAI,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;AAE3F,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,IAAI,MAAM,EAAE,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"typed-routes.d.ts","sourceRoot":"","sources":["../src/typed-routes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAC5E,MAAM,MAAM,iBAAiB,GAAG,MAAM,CACpC,MAAM,EACN,gBAAgB,GAAG,SAAS,gBAAgB,EAAE,CAC/C,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,IAAI,MAAM,EAAE,IAAI,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;AAE3F,MAAM,MAAM,YAA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,GAAG,IAAI,eAAe,EAAE,CAAC;IAErC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBAC1C,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAEhC,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC;AACzC,CAAC","sourcesContent":["export type RouteSearchValue = boolean | number | string | null | undefined;\nexport type RouteSearchParams = Record<\n string,\n RouteSearchValue | readonly RouteSearchValue[]\n>;\n\nexport type RouteParamsFor<Path extends `/${string}`> = Simplify<ExtractRouteParams<Path>>;\n\nexport type AppRouteHref<Path extends `/${string}`> = keyof RouteParamsFor<Path> extends never\n ? (options?: StaticHrefOptions) => string\n : (options: DynamicHrefOptions<Path>) => string;\n\nexport type AppRouteLinkHref<Path extends `/${string}`> =\n `${AppRouteLinkPathname<Path>}${AppRouteLinkHrefSuffix}`;\n\nexport interface StaticHrefOptions {\n hash?: string | undefined;\n search?: RouteSearchParams | undefined;\n}\n\nexport interface DynamicHrefOptions<Path extends `/${string}`> extends StaticHrefOptions {\n params: RouteParamsFor<Path>;\n}\n\ntype HasRouteParams<Path extends `/${string}`> = keyof RouteParamsFor<Path> extends never\n ? false\n : true;\n\ntype ExtractRouteParams<Path extends string> = Path extends `${infer Segment}/${infer Rest}`\n ? SegmentRouteParam<Segment> & ExtractRouteParams<Rest>\n : SegmentRouteParam<Path>;\n\ntype SegmentRouteParam<Segment extends string> = Segment extends `:...${infer Name}`\n ? { [Key in Name]: readonly string[] }\n : Segment extends `:${infer Name}`\n ? { [Key in Name]: string }\n : Record<never, never>;\n\ntype Simplify<T> = { [Key in keyof T]: T[Key] } & {};\n\nexport type AppRouteLinkHrefSuffix = \"\" | `?${string}` | `#${string}` | `?${string}#${string}`;\n\nexport type AppRouteLinkPathname<Path extends `/${string}`> = Path extends \"/\"\n ? \"/\"\n : Path extends `/${infer Segments}`\n ? `/${AppRouteLinkSegments<Segments>}`\n : never;\n\nexport type AppRouteLinkSegments<Segments extends string> = Segments extends `${infer Segment}/${infer Rest}`\n ? `${AppRouteLinkSegment<Segment>}/${AppRouteLinkSegments<Rest>}`\n : AppRouteLinkSegment<Segments>;\n\nexport type AppRouteLinkSegment<Segment extends string> = Segment extends `:${string}`\n ? string\n : Segment;\n\nexport function href<const Path extends `/${string}`>(\n path: Path,\n ...args: HasRouteParams<Path> extends true\n ? [options: DynamicHrefOptions<Path>]\n : [options?: StaticHrefOptions]\n): string {\n assertInternalRoutePath(path);\n\n const options = args[0] as\n | (StaticHrefOptions & { params?: Record<string, readonly string[] | string> | undefined })\n | undefined;\n const params =\n options !== undefined && \"params\" in options && options.params !== undefined\n ? (options.params as Record<string, readonly string[] | string>)\n : {};\n const pathname = path\n .split(\"/\")\n .map((segment) => {\n if (segment.startsWith(\":...\")) {\n const name = segment.slice(4);\n const value = params[name];\n\n if (!Array.isArray(value)) {\n throw new Error(`Missing catch-all route param ${JSON.stringify(name)} for ${path}.`);\n }\n\n return value.map((part) => encodeURIComponent(part)).join(\"/\");\n }\n\n if (segment.startsWith(\":\")) {\n const name = segment.slice(1);\n const value = params[name];\n\n if (typeof value !== \"string\") {\n throw new Error(`Missing route param ${JSON.stringify(name)} for ${path}.`);\n }\n\n return encodeURIComponent(value);\n }\n\n return segment;\n })\n .join(\"/\");\n const search = searchString(options?.search);\n const hash = options?.hash === undefined ? \"\" : `#${encodeURIComponent(options.hash)}`;\n\n return `${pathname}${search}${hash}`;\n}\n\nfunction assertInternalRoutePath(path: string): void {\n if (!path.startsWith(\"/\") || path.startsWith(\"//\")) {\n throw new Error(`href() expected an internal route path, received ${JSON.stringify(path)}.`);\n }\n\n for (let index = 0; index < path.length; index += 1) {\n const code = path.charCodeAt(index);\n\n if (code <= 0x1f || code === 0x7f) {\n throw new Error(\"href() route paths must not contain control characters.\");\n }\n }\n}\n\nfunction searchString(search: RouteSearchParams | undefined): string {\n if (search === undefined) {\n return \"\";\n }\n\n const params = new URLSearchParams();\n\n for (const [key, value] of Object.entries(search)) {\n const values = Array.isArray(value) ? value : [value];\n\n for (const entry of values) {\n if (entry !== undefined && entry !== null) {\n params.append(key, String(entry));\n }\n }\n }\n\n const value = params.toString();\n\n return value === \"\" ? \"\" : `?${value}`;\n}\n"]}
|
package/dist/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,UAAU,EAEhB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AA0BhE,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KA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,MAAM,YAAY,kCAA4B,CAAC;AAoCtD,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,SAAS,OAAO,EAAE,GAC1B,wBAAwB,GAAG,SAAS,CActC;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,kBAAkB,CAc5B;AAyFD,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,CAAA;CAAO,GACjF,OAAO,CAAC,QAAQ,CAAC,CAuEnB"}
|
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { dirname
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
3
|
import { formatDiagnostic } from "@reckona/mreact-compiler";
|
|
4
4
|
import { createCompilerModuleContext, transformCompilerModuleContext, } from "@reckona/mreact-compiler/internal";
|
|
5
5
|
import { normalizePath, } from "vite";
|
|
@@ -13,6 +13,7 @@ import { collectRouteCssHrefs, collectSpecialBoundaryFiles, createCachedRouteSou
|
|
|
13
13
|
import { createRouteMatcher, scanAppRoutes } from "./routes.js";
|
|
14
14
|
import { resolveRequestHost } from "./serve.js";
|
|
15
15
|
import { hasJsxSyntax } from "./source-jsx.js";
|
|
16
|
+
import { prependTailwindSourceDirectives } from "./tailwind-source.js";
|
|
16
17
|
import { workspacePackageFile } from "./workspace-packages.js";
|
|
17
18
|
const clientPrefix = "/_mreact/client/";
|
|
18
19
|
const devCssPrefix = "/_mreact/dev-css/";
|
|
@@ -521,35 +522,12 @@ function isDevCssSourceModuleId(id) {
|
|
|
521
522
|
}
|
|
522
523
|
async function loadDevCssSourceModule(options) {
|
|
523
524
|
const code = await readFile(options.cssFile, "utf8");
|
|
524
|
-
return
|
|
525
|
+
return prependTailwindSourceDirectives({
|
|
525
526
|
code,
|
|
526
527
|
cssFile: options.cssFile,
|
|
527
528
|
sourceDirs: options.sourceDirs,
|
|
528
529
|
});
|
|
529
530
|
}
|
|
530
|
-
function prependDevTailwindSourceDirectives(options) {
|
|
531
|
-
if (!isTailwindCssEntry(options.code)) {
|
|
532
|
-
return options.code;
|
|
533
|
-
}
|
|
534
|
-
const cssDir = dirname(options.cssFile);
|
|
535
|
-
const directives = [...new Set(options.sourceDirs)]
|
|
536
|
-
.map((sourceDir) => `${devTailwindSourceDirective(cssDir, sourceDir)}\n`)
|
|
537
|
-
.join("");
|
|
538
|
-
return directives.length === 0 ? options.code : `${directives}${options.code}`;
|
|
539
|
-
}
|
|
540
|
-
function isTailwindCssEntry(code) {
|
|
541
|
-
return (/@import\s+(?:url\()?["']tailwindcss(?:\/[^"']*)?["']\)?/u.test(code) ||
|
|
542
|
-
/@tailwind\s+(?:base|components|utilities)\b/u.test(code));
|
|
543
|
-
}
|
|
544
|
-
function devTailwindSourceDirective(cssDir, sourceDir) {
|
|
545
|
-
const relativeSourceDir = relative(cssDir, sourceDir).split(sep).join("/");
|
|
546
|
-
const normalizedSourceDir = relativeSourceDir === ""
|
|
547
|
-
? "."
|
|
548
|
-
: relativeSourceDir.startsWith(".")
|
|
549
|
-
? relativeSourceDir
|
|
550
|
-
: `./${relativeSourceDir}`;
|
|
551
|
-
return `@source ${JSON.stringify(`${normalizedSourceDir}/**/*.{js,jsx,ts,tsx,mdx}`)};`;
|
|
552
|
-
}
|
|
553
531
|
function importerInRuntimePackage(importer, directories, packageNames) {
|
|
554
532
|
if (importer === undefined) {
|
|
555
533
|
return false;
|