diff --git a/docs/fern/docs/pages-template/sdk/types/contact-channel.mdx b/docs/fern/docs/pages-template/sdk/types/contact-channel.mdx index 899d32d3c..a8d015015 100644 --- a/docs/fern/docs/pages-template/sdk/types/contact-channel.mdx +++ b/docs/fern/docs/pages-template/sdk/types/contact-channel.mdx @@ -20,8 +20,7 @@ On this page: Basic information about a contact channel, as seen by a user themselves. Usually obtained by calling [`user.listContactChannels()`](../types/user.mdx#currentuserlistcontactchannels) -{/* NEXT_LINE_PLATFORM react-like */} -or [`user.useContactChannels()`](../types/user.mdx#currentuserusecontactchannels) +or [`user.useContactChannels()`](../types/user.mdx#currentuserusecontactchannels) {/* THIS_LINE_PLATFORM react-like */} . ### Table of Contents @@ -279,8 +278,7 @@ await contactChannel.delete(); Like `ContactChannel`, but includes additional methods and properties that require the `SECRET_SERVER_KEY`. Usually obtained by calling [`serverUser.listContactChannels()`](../types/user.mdx#serveruserlistcontactchannels) -{/* NEXT_LINE_PLATFORM react-like */} -or [`serverUser.useContactChannels()`](../types/user.mdx#serveruserusecontactchannels) +or [`serverUser.useContactChannels()`](../types/user.mdx#serveruserusecontactchannels) {/* THIS_LINE_PLATFORM react-like */} . ### Table of Contents diff --git a/docs/fern/docs/pages-template/sdk/types/project.mdx b/docs/fern/docs/pages-template/sdk/types/project.mdx index 979a7c16c..120575d88 100644 --- a/docs/fern/docs/pages-template/sdk/types/project.mdx +++ b/docs/fern/docs/pages-template/sdk/types/project.mdx @@ -8,8 +8,7 @@ slug: sdk/types/project The `Project` object contains the information and configuration of a project, such as the name, description, and enabled authentication methods. Each [Stack app](../../concepts/stack-app.mdx) corresponds to a project. You can obtain its `Project` object by calling [`stackApp.getProject()`](../objects/stack-app.mdx#stackappgetproject) -{/* NEXT_LINE_PLATFORM react-like */} -or [`stackApp.useProject()`](../objects/stack-app.mdx#stackappuseproject) +or [`stackApp.useProject()`](../objects/stack-app.mdx#stackappuseproject) {/* THIS_LINE_PLATFORM react-like */} . ### Table of Contents diff --git a/docs/fern/docs/pages-template/sdk/types/team-user.mdx b/docs/fern/docs/pages-template/sdk/types/team-user.mdx index fc71eb1f6..6d369483b 100644 --- a/docs/fern/docs/pages-template/sdk/types/team-user.mdx +++ b/docs/fern/docs/pages-template/sdk/types/team-user.mdx @@ -19,8 +19,7 @@ On this page: The `TeamUser` object is used on the client side to represent a user in the context of a team, providing minimal information about the user, including their ID and team-specific profile. It is usually obtained by calling -{/* NEXT_LINE_PLATFORM react-like */} -`team.useUsers()` or +`team.useUsers()` or {/* THIS_LINE_PLATFORM react-like */} `team.listUsers()` on a [`Team` object](../types/team.mdx#team). ### Table of Contents diff --git a/docs/fern/docs/pages-template/sdk/types/team.mdx b/docs/fern/docs/pages-template/sdk/types/team.mdx index 492bd8b0f..5690f0382 100644 --- a/docs/fern/docs/pages-template/sdk/types/team.mdx +++ b/docs/fern/docs/pages-template/sdk/types/team.mdx @@ -21,8 +21,7 @@ On this page: A `Team` object contains basic information and functions about a team, to the extent of which a member of the team would have access to it. You can get `Team` objects with the -{/* NEXT_LINE_PLATFORM react-like */} -`user.useTeams()` or +`user.useTeams()` or {/* THIS_LINE_PLATFORM react-like */} `user.listTeams()` functions. The created team will then inherit the permissions of that user; for example, the `team.update(...)` function can only succeed if the user is allowed to make updates to the team. ### Table of Contents diff --git a/packages/template/src/components-page/stack-handler.tsx b/packages/template/src/components-page/stack-handler.tsx index 31e7becfb..e3fe9bc84 100644 --- a/packages/template/src/components-page/stack-handler.tsx +++ b/packages/template/src/components-page/stack-handler.tsx @@ -1,8 +1,7 @@ import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors"; import { FilterUndefined, filterUndefined, pick } from "@stackframe/stack-shared/dist/utils/objects"; import { getRelativePart } from "@stackframe/stack-shared/dist/utils/urls"; -// NEXT_LINE_PLATFORM next -import { RedirectType, notFound, redirect } from 'next/navigation'; +import { RedirectType, notFound, redirect } from 'next/navigation'; // THIS_LINE_PLATFORM next import { useMemo } from 'react'; import { SignIn, SignUp, StackServerApp } from ".."; import { IframePreventer } from "../components/iframe-preventer"; diff --git a/packages/template/src/components/link.tsx b/packages/template/src/components/link.tsx index c7be5b09b..c93bdb5a6 100644 --- a/packages/template/src/components/link.tsx +++ b/packages/template/src/components/link.tsx @@ -1,8 +1,7 @@ 'use client'; import { cn } from "@stackframe/stack-ui"; -// NEXT_LINE_PLATFORM next -import NextLink from 'next/link'; +import NextLink from 'next/link'; // THIS_LINE_PLATFORM next type LinkProps = { href: string, diff --git a/packages/template/src/lib/cookie.ts b/packages/template/src/lib/cookie.ts index 9f0ad6740..4010c69d7 100644 --- a/packages/template/src/lib/cookie.ts +++ b/packages/template/src/lib/cookie.ts @@ -1,5 +1,4 @@ -// NEXT_LINE_PLATFORM next -import { cookies as rscCookies, headers as rscHeaders } from '@stackframe/stack-sc/force-react-server'; +import { cookies as rscCookies, headers as rscHeaders } from '@stackframe/stack-sc/force-react-server'; // THIS_LINE_PLATFORM next import { isBrowserLike } from '@stackframe/stack-shared/dist/utils/env'; import { StackAssertionError } from '@stackframe/stack-shared/dist/utils/errors'; import Cookies from "js-cookie"; diff --git a/packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts b/packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts index de632b0e9..6b8c39c29 100644 --- a/packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts +++ b/packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts @@ -7,8 +7,8 @@ import { InternalProjectsCrud } from "@stackframe/stack-shared/dist/interface/cr import { StackAssertionError, throwErr } from "@stackframe/stack-shared/dist/utils/errors"; import { pick } from "@stackframe/stack-shared/dist/utils/objects"; import { Result } from "@stackframe/stack-shared/dist/utils/results"; - -import { InternalEmailsCrud } from "@stackframe/stack-shared/dist/interface/crud/emails"; +import { useMemo } from "react"; // THIS_LINE_PLATFORM react-like +import { AdminSentEmail } from "../.."; import { ApiKey, ApiKeyBase, ApiKeyBaseCrudRead, ApiKeyCreateOptions, ApiKeyFirstView, apiKeyCreateOptionsToCrud } from "../../api-keys"; import { EmailConfig, stackAppInternalsSymbol } from "../../common"; import { AdminEmailTemplate, AdminEmailTemplateUpdateOptions, adminEmailTemplateUpdateOptionsToCrud } from "../../email-templates"; @@ -18,12 +18,8 @@ import { StackAdminApp, StackAdminAppConstructorOptions } from "../interfaces/ad import { clientVersion, createCache, getBaseUrl, getDefaultProjectId, getDefaultPublishableClientKey, getDefaultSecretServerKey, getDefaultSuperSecretAdminKey } from "./common"; import { _StackServerAppImplIncomplete } from "./server-app-impl"; -// NEXT_LINE_PLATFORM react-like -import { useMemo } from "react"; // NEXT_LINE_PLATFORM react-like import { useAsyncCache } from "./common"; -import { AdminSentEmail } from "../../email"; - export class _StackAdminAppImplIncomplete extends _StackServerAppImplIncomplete { diff --git a/packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts b/packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts index 6d01b17c2..f2a1eee27 100644 --- a/packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts +++ b/packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts @@ -24,10 +24,8 @@ import { deindent, mergeScopeStrings } from "@stackframe/stack-shared/dist/utils import { getRelativePart, isRelative } from "@stackframe/stack-shared/dist/utils/urls"; import { generateUuid } from "@stackframe/stack-shared/dist/utils/uuids"; import * as cookie from "cookie"; -// NEXT_LINE_PLATFORM next -import * as NextNavigationUnscrambled from "next/navigation"; // import the entire module to get around some static compiler warnings emitted by Next.js in some cases -// NEXT_LINE_PLATFORM react-like -import React, { useCallback, useMemo } from "react"; +import * as NextNavigationUnscrambled from "next/navigation"; // import the entire module to get around some static compiler warnings emitted by Next.js in some cases | THIS_LINE_PLATFORM next +import React, { useCallback, useMemo } from "react"; // THIS_LINE_PLATFORM react-like import { constructRedirectUrl } from "../../../../utils/url"; import { addNewOAuthProviderOrScope, callOAuthCallback, signInWithOAuth } from "../../../auth"; import { CookieHelper, createBrowserCookieHelper, createCookieHelper, createPlaceholderCookieHelper, deleteCookieClient, getCookieClient, setOrDeleteCookie, setOrDeleteCookieClient } from "../../../cookie"; @@ -41,8 +39,8 @@ import { ActiveSession, Auth, BaseUser, CurrentUser, InternalUserExtra, ProjectC import { StackClientApp, StackClientAppConstructorOptions, StackClientAppJson } from "../interfaces/client-app"; import { _StackAdminAppImplIncomplete } from "./admin-app-impl"; import { TokenObject, clientVersion, createCache, createCacheBySession, createEmptyTokenStore, getBaseUrl, getDefaultProjectId, getDefaultPublishableClientKey, getUrls } from "./common"; -// NEXT_LINE_PLATFORM react-like -import { useAsyncCache } from "./common"; + +import { useAsyncCache } from "./common"; // THIS_LINE_PLATFORM react-like let isReactServer = false; // IF_PLATFORM next @@ -55,8 +53,7 @@ const NextNavigation = scrambleDuringCompileTime(NextNavigationUnscrambled); // END_PLATFORM // hack to make sure process is defined in non-node environments -// NEXT_LINE_PLATFORM js react -const process = (globalThis as any).process ?? { env: {} }; +const process = (globalThis as any).process ?? { env: {} }; // THIS_LINE_PLATFORM js react const allClientApps = new Map]>(); @@ -267,16 +264,14 @@ export class _StackClientAppImplIncomplete { - // NEXT_LINE_PLATFORM next - await cookies?.(); + await cookies?.(); // THIS_LINE_PLATFORM next } }); } this._tokenStoreInit = _options.tokenStore; this._redirectMethod = _options.redirectMethod || "none"; - // NEXT_LINE_PLATFORM next - this._redirectMethod = _options.redirectMethod || "nextjs"; + this._redirectMethod = _options.redirectMethod || "nextjs"; // THIS_LINE_PLATFORM next this._urlOptions = _options.urls ?? {}; this._oauthScopesOnSignIn = _options.oauthScopesOnSignIn ?? {}; @@ -832,8 +827,7 @@ export class _StackClientAppImplIncomplete t.id === teamId) ?? null; diff --git a/packages/template/src/lib/stack-app/apps/implementations/common.ts b/packages/template/src/lib/stack-app/apps/implementations/common.ts index 4972995e4..3588feee2 100644 --- a/packages/template/src/lib/stack-app/apps/implementations/common.ts +++ b/packages/template/src/lib/stack-app/apps/implementations/common.ts @@ -7,13 +7,11 @@ import { ReactPromise } from "@stackframe/stack-shared/dist/utils/promises"; import { suspendIfSsr } from "@stackframe/stack-shared/dist/utils/react"; import { Result } from "@stackframe/stack-shared/dist/utils/results"; import { Store } from "@stackframe/stack-shared/dist/utils/stores"; +import React, { useCallback } from "react"; // THIS_LINE_PLATFORM react-like import { HandlerUrls } from "../../common"; -// NEXT_LINE_PLATFORM react-like -import React, { useCallback } from "react"; // hack to make sure process is defined in non-node environments -// NEXT_LINE_PLATFORM js react -const process = (globalThis as any).process ?? { env: {} }; +const process = (globalThis as any).process ?? { env: {} }; // THIS_LINE_PLATFORM js react export const clientVersion = "STACK_COMPILE_TIME_CLIENT_PACKAGE_VERSION_SENTINEL"; if (clientVersion.startsWith("STACK_COMPILE_TIME")) { diff --git a/packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts b/packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts index ccf04d56e..ecbe0fd36 100644 --- a/packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts +++ b/packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts @@ -11,8 +11,7 @@ import { ProviderType } from "@stackframe/stack-shared/dist/utils/oauth"; import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises"; import { suspend } from "@stackframe/stack-shared/dist/utils/react"; import { Result } from "@stackframe/stack-shared/dist/utils/results"; -// NEXT_LINE_PLATFORM react-like -import { useMemo } from "react"; +import { useMemo } from "react"; // THIS_LINE_PLATFORM react-like import { constructRedirectUrl } from "../../../../utils/url"; import { GetUserOptions, HandlerUrls, OAuthScopesOnSignIn, TokenStoreInit } from "../../common"; import { OAuthConnection } from "../../connected-accounts"; @@ -23,10 +22,10 @@ import { ProjectCurrentServerUser, ServerUser, ServerUserCreateOptions, ServerUs import { StackServerAppConstructorOptions } from "../interfaces/server-app"; import { _StackClientAppImplIncomplete } from "./client-app-impl"; import { clientVersion, createCache, createCacheBySession, getBaseUrl, getDefaultProjectId, getDefaultPublishableClientKey, getDefaultSecretServerKey } from "./common"; + // NEXT_LINE_PLATFORM react-like import { useAsyncCache } from "./common"; - export class _StackServerAppImplIncomplete extends _StackClientAppImplIncomplete { declare protected _interface: StackServerInterface; @@ -269,8 +268,7 @@ export class _StackServerAppImplIncomplete & AsyncStoreProperty<"teamPermissionDefinitions", [], AdminTeamPermissionDefinition[], true> & { - // NEXT_LINE_PLATFORM react-like - useEmailTemplates(): AdminEmailTemplate[], + useEmailTemplates(): AdminEmailTemplate[], // THIS_LINE_PLATFORM react-like listEmailTemplates(): Promise, updateEmailTemplate(type: EmailTemplateType, data: AdminEmailTemplateUpdateOptions): Promise, resetEmailTemplate(type: EmailTemplateType): Promise, @@ -44,8 +43,7 @@ export type StackAdminApp, deleteTeamPermissionDefinition(permissionId: string): Promise, - // NEXT_LINE_PLATFORM react-like - useSvixToken(): string, + useSvixToken(): string, // THIS_LINE_PLATFORM react-like sendTestEmail(options: { recipientEmail: string, diff --git a/packages/template/src/lib/stack-app/apps/interfaces/client-app.ts b/packages/template/src/lib/stack-app/apps/interfaces/client-app.ts index ebd7107d6..ea5216918 100644 --- a/packages/template/src/lib/stack-app/apps/interfaces/client-app.ts +++ b/packages/template/src/lib/stack-app/apps/interfaces/client-app.ts @@ -63,8 +63,7 @@ export type StackClientApp & { or: 'throw' }): Promise>, getUser(options?: GetUserOptions): Promise | null>, - // NEXT_LINE_PLATFORM react-like - useNavigate(): (to: string) => void, + useNavigate(): (to: string) => void, // THIS_LINE_PLATFORM react-like [stackAppInternalsSymbol]: { toClientJson(): StackClientAppJson, diff --git a/packages/template/src/lib/stack-app/apps/interfaces/server-app.ts b/packages/template/src/lib/stack-app/apps/interfaces/server-app.ts index c2aeffebf..9495a0cc2 100644 --- a/packages/template/src/lib/stack-app/apps/interfaces/server-app.ts +++ b/packages/template/src/lib/stack-app/apps/interfaces/server-app.ts @@ -29,8 +29,7 @@ export type StackServerApp & { or: 'throw' }): Promise>, getUser(options?: GetUserOptions): Promise | null>, - // NEXT_LINE_PLATFORM react-like - useUsers(options?: ServerListUsersOptions): ServerUser[] & { nextCursor: string | null }, + useUsers(options?: ServerListUsersOptions): ServerUser[] & { nextCursor: string | null }, // THIS_LINE_PLATFORM react-like listUsers(options?: ServerListUsersOptions): Promise, } & AsyncStoreProperty<"user", [id: string], ServerUser | null, false> diff --git a/packages/template/src/lib/stack-app/common.ts b/packages/template/src/lib/stack-app/common.ts index a98f53c87..fc7343a47 100644 --- a/packages/template/src/lib/stack-app/common.ts +++ b/packages/template/src/lib/stack-app/common.ts @@ -7,8 +7,7 @@ export type RedirectToOptions = { export type AsyncStoreProperty = & { [key in `${IsMultiple extends true ? "list" : "get"}${Capitalize}`]: (...args: Args) => Promise } - // NEXT_LINE_PLATFORM react-like - & { [key in `use${Capitalize}`]: (...args: Args) => Value } + & { [key in `use${Capitalize}`]: (...args: Args) => Value } // THIS_LINE_PLATFORM react-like export type EmailConfig = { host: string, @@ -20,8 +19,7 @@ export type EmailConfig = { } export type RedirectMethod = "window" - // NEXT_LINE_PLATFORM next - | "nextjs" + | "nextjs" // THIS_LINE_PLATFORM next | "none" | { useNavigate: () => (to: string) => void, diff --git a/packages/template/src/lib/stack-app/connected-accounts/index.ts b/packages/template/src/lib/stack-app/connected-accounts/index.ts index 76df6d1c5..d4ebe38d9 100644 --- a/packages/template/src/lib/stack-app/connected-accounts/index.ts +++ b/packages/template/src/lib/stack-app/connected-accounts/index.ts @@ -6,6 +6,5 @@ export type Connection = { export type OAuthConnection = { getAccessToken(): Promise<{ accessToken: string }>, - // NEXT_LINE_PLATFORM react-like - useAccessToken(): { accessToken: string }, + useAccessToken(): { accessToken: string }, // THIS_LINE_PLATFORM react-like } & Connection; diff --git a/packages/template/src/lib/stack-app/teams/index.ts b/packages/template/src/lib/stack-app/teams/index.ts index e351f6e96..d09f5df5a 100644 --- a/packages/template/src/lib/stack-app/teams/index.ts +++ b/packages/template/src/lib/stack-app/teams/index.ts @@ -38,11 +38,9 @@ export type Team = { clientReadOnlyMetadata: any, inviteUser(options: { email: string, callbackUrl?: string }): Promise, listUsers(): Promise, - // NEXT_LINE_PLATFORM react-like - useUsers(): TeamUser[], + useUsers(): TeamUser[], // THIS_LINE_PLATFORM react-like listInvitations(): Promise, - // NEXT_LINE_PLATFORM react-like - useInvitations(): TeamInvitation[], + useInvitations(): TeamInvitation[], // THIS_LINE_PLATFORM react-like update(update: TeamUpdateOptions): Promise, delete(): Promise, }; @@ -83,8 +81,7 @@ export type ServerTeam = { createdAt: Date, serverMetadata: any, listUsers(): Promise, - // NEXT_LINE_PLATFORM react-like - useUsers(): ServerUser[], + useUsers(): ServerUser[], // THIS_LINE_PLATFORM react-like update(update: ServerTeamUpdateOptions): Promise, delete(): Promise, addUser(userId: string): Promise, diff --git a/packages/template/src/lib/stack-app/users/index.ts b/packages/template/src/lib/stack-app/users/index.ts index 01d053865..fa32f1585 100644 --- a/packages/template/src/lib/stack-app/users/index.ts +++ b/packages/template/src/lib/stack-app/users/index.ts @@ -172,8 +172,7 @@ export type UserExtra = { */ update(update: UserUpdateOptions): Promise, - // NEXT_LINE_PLATFORM react-like - useContactChannels(): ContactChannel[], + useContactChannels(): ContactChannel[], // THIS_LINE_PLATFORM react-like listContactChannels(): Promise, createContactChannel(data: ContactChannelCreateOptions): Promise, @@ -197,8 +196,7 @@ export type UserExtra = { getActiveSessions(): Promise, revokeSession(sessionId: string): Promise, getTeamProfile(team: Team): Promise, - // NEXT_LINE_PLATFORM react-like - useTeamProfile(team: Team): EditableTeamMemberProfile, + useTeamProfile(team: Team): EditableTeamMemberProfile, // THIS_LINE_PLATFORM react-like } & AsyncStoreProperty<"team", [id: string], Team | null, false> & AsyncStoreProperty<"teams", [], Team[], true> @@ -263,8 +261,7 @@ export type ServerBaseUser = { createTeam(data: Omit): Promise, - // NEXT_LINE_PLATFORM react-like - useContactChannels(): ServerContactChannel[], + useContactChannels(): ServerContactChannel[], // THIS_LINE_PLATFORM react-like listContactChannels(): Promise, createContactChannel(data: ServerContactChannelCreateOptions): Promise, diff --git a/packages/template/src/lib/translations.tsx b/packages/template/src/lib/translations.tsx index 5013c6c62..2a45d1361 100644 --- a/packages/template/src/lib/translations.tsx +++ b/packages/template/src/lib/translations.tsx @@ -1,5 +1,4 @@ -// NEXT_LINE_PLATFORM next -import "client-only"; +import "client-only"; // THIS_LINE_PLATFORM next import React from "react"; import { TranslationContext } from "../providers/translation-provider-client"; diff --git a/scripts/generate-docs.ts b/scripts/generate-docs.ts index 12c6a050b..8f8846467 100644 --- a/scripts/generate-docs.ts +++ b/scripts/generate-docs.ts @@ -65,8 +65,6 @@ function processDocObject(obj: any, platforms: string[]): { result: any, validPa } } - - withGeneratorLock(async () => { const docsDir = path.resolve(__dirname, "..", "docs", "fern"); const templateDir = path.join(docsDir, "docs", "pages-template"); diff --git a/scripts/utils.ts b/scripts/utils.ts index 212c2169c..c494c8ece 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -139,18 +139,20 @@ export function processMacros(content: string, platforms: string[]): string { * - ELSE_PLATFORM * - END_PLATFORM * - NEXT_LINE_PLATFORM + * - THIS_LINE_PLATFORM * * And then capture everything after that keyword up to the end of the line. * * Examples: - * "blah blah IF_PLATFORM platform1 platform2 ???" => captures "platform platform2 ???" + * "blah blah IF_PLATFORM platform1 platform2 ???" => captures "platform1 platform2 ???" * "adsfasdf ELSE_PLATFORM blabla" => captures "blabla" */ - const reBeginOnly = /\bIF_PLATFORM:?\s+(.+)/i; - const reElseIf = /\bELSE_IF_PLATFORM:?\s+(.+)/i; - const reElse = /\bELSE_PLATFORM\b/i; - const reEndOnly = /\bEND_PLATFORM\b/i; - const reNextLine = /\bNEXT_LINE_PLATFORM:?\s+(.+)/i; + const reBeginOnly = /\bIF_PLATFORM:?\s+(.+)/i; + const reElseIf = /\bELSE_IF_PLATFORM:?\s+(.+)/i; + const reElse = /\bELSE_PLATFORM\b/i; + const reEndOnly = /\bEND_PLATFORM\b/i; + const reNextLine = /\bNEXT_LINE_PLATFORM:?\s+(.+)/i; + const reThisLine = /\bTHIS_LINE_PLATFORM:?\s+(.+)/i; // New regex for (const line of lines) { // 1) Try detecting IF_PLATFORM ... @@ -259,6 +261,19 @@ export function processMacros(content: string, platforms: string[]): string { continue; } + // 6) Try detecting THIS_LINE_PLATFORM ... (new behavior) + const thisLineMatch = line.match(reThisLine); + if (thisLineMatch) { + const platformList = parsePlatformList(thisLineMatch[1]); + const matched = platformList.some((e) => platforms.includes(e)); + if (matched) { + // Output the line unchanged (including the directive itself) + result.push(line); + } + // Whether matched or not, skip further processing of this line + continue; + } + // If it's a normal line: if (shouldOutputLine()) { result.push(line);