@shopify/hydrogen 0.20.0 → 0.22.1
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/CHANGELOG.md +151 -0
- package/dist/esnext/client.d.ts +1 -0
- package/dist/esnext/client.js +1 -0
- package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +1 -1
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +1 -1
- package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +7 -4
- package/dist/esnext/components/CartProvider/CartProvider.client.js +22 -12
- package/dist/esnext/components/Image/Image.d.ts +3 -3
- package/dist/esnext/components/Image/Image.js +12 -9
- package/dist/esnext/components/MediaFile/MediaFile.js +3 -2
- package/dist/esnext/components/Money/Money.client.d.ts +11 -5
- package/dist/esnext/components/Money/Money.client.js +16 -3
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +1 -2
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +1 -2
- package/dist/esnext/components/Seo/NoIndexSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/NoIndexSeo.client.js +10 -0
- package/dist/esnext/components/Seo/Seo.client.d.ts +4 -0
- package/dist/esnext/components/Seo/Seo.client.js +3 -0
- package/dist/esnext/components/index.d.ts +0 -3
- package/dist/esnext/components/index.js +0 -3
- package/dist/esnext/config.d.ts +3 -3
- package/dist/esnext/entry-client.js +0 -3
- package/dist/esnext/entry-server.d.ts +2 -2
- package/dist/esnext/entry-server.js +97 -73
- package/dist/esnext/foundation/Analytics/Analytics.client.js +1 -1
- package/dist/esnext/foundation/Analytics/ClientAnalytics.js +2 -2
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +2 -2
- package/dist/esnext/foundation/Analytics/index.d.ts +0 -1
- package/dist/esnext/foundation/Analytics/index.js +0 -1
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +5 -10
- package/dist/esnext/foundation/Router/BrowserRouter.client.d.ts +2 -1
- package/dist/esnext/foundation/Router/BrowserRouter.client.js +1 -1
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +0 -2
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +18 -3
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +0 -1
- package/dist/esnext/foundation/useQuery/hooks.js +8 -9
- package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +2 -1
- package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +1 -1
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +2 -2
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +1 -10
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +2 -20
- package/dist/esnext/framework/Hydration/rsc.js +55 -7
- package/dist/esnext/framework/cache/in-memory.js +0 -6
- package/dist/esnext/framework/cache-sub-request.d.ts +17 -0
- package/dist/esnext/framework/cache-sub-request.js +64 -0
- package/dist/esnext/framework/cache.d.ts +6 -6
- package/dist/esnext/framework/cache.js +36 -33
- package/dist/esnext/framework/middleware.js +1 -15
- package/dist/esnext/framework/plugin.js +4 -0
- package/dist/esnext/framework/plugins/vite-plugin-client-imports.d.ts +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-client-imports.js +25 -0
- package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +8 -3
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +2 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +6 -47
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +6 -11
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +7 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +99 -0
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +4 -4
- package/dist/esnext/framework/viteception.d.ts +4 -0
- package/dist/esnext/framework/viteception.js +15 -0
- package/dist/esnext/hooks/useShopQuery/hooks.d.ts +1 -2
- package/dist/esnext/hooks/useShopQuery/hooks.js +0 -1
- package/dist/esnext/index.d.ts +24 -9
- package/dist/esnext/index.js +24 -13
- package/dist/esnext/storefront-api-types.d.ts +1 -1
- package/dist/esnext/streaming.server.d.ts +3 -1
- package/dist/esnext/types.d.ts +13 -5
- package/dist/esnext/utilities/apiRoutes.d.ts +4 -5
- package/dist/esnext/utilities/apiRoutes.js +2 -8
- package/dist/esnext/utilities/fetch.d.ts +1 -2
- package/dist/esnext/utilities/fetch.js +1 -3
- package/dist/esnext/utilities/graphql-tag.d.ts +1 -0
- package/dist/esnext/utilities/graphql-tag.js +6 -0
- package/dist/esnext/utilities/graphql-tracker.d.ts +1 -1
- package/dist/esnext/utilities/graphql-tracker.js +4 -0
- package/dist/esnext/utilities/html-encoding.d.ts +1 -0
- package/dist/esnext/utilities/html-encoding.js +8 -0
- package/dist/esnext/utilities/index.d.ts +1 -0
- package/dist/esnext/utilities/index.js +1 -0
- package/dist/esnext/utilities/log/log-cache-api-status.js +5 -1
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/components/Image/Image.d.ts +3 -3
- package/dist/node/components/Image/Image.js +12 -9
- package/dist/node/entry-server.d.ts +2 -2
- package/dist/node/entry-server.js +97 -73
- package/dist/node/foundation/Analytics/Analytics.client.js +6 -6
- package/dist/node/foundation/Analytics/ClientAnalytics.js +2 -2
- package/dist/node/foundation/Router/BrowserRouter.client.d.ts +2 -1
- package/dist/node/foundation/Router/BrowserRouter.client.js +1 -1
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.js +0 -2
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +18 -3
- package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +2 -2
- package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +1 -10
- package/dist/node/framework/Hydration/ServerComponentResponse.server.js +2 -20
- package/dist/node/framework/Hydration/rsc.js +55 -7
- package/dist/node/framework/cache/in-memory.js +0 -6
- package/dist/node/framework/cache-sub-request.d.ts +17 -0
- package/dist/node/framework/cache-sub-request.js +95 -0
- package/dist/node/framework/cache.d.ts +6 -6
- package/dist/node/framework/cache.js +38 -35
- package/dist/node/framework/middleware.js +1 -15
- package/dist/node/framework/plugin.js +4 -0
- package/dist/node/framework/plugins/vite-plugin-client-imports.d.ts +2 -0
- package/dist/node/framework/plugins/vite-plugin-client-imports.js +28 -0
- package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +8 -3
- package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +1 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +2 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +5 -46
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +6 -11
- package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +7 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +105 -0
- package/dist/node/framework/plugins/vite-plugin-platform-entry.js +4 -4
- package/dist/node/framework/viteception.d.ts +4 -0
- package/dist/node/framework/viteception.js +19 -0
- package/dist/node/storefront-api-types.d.ts +1 -1
- package/dist/node/streaming.server.d.ts +3 -1
- package/dist/node/types.d.ts +13 -5
- package/dist/node/utilities/apiRoutes.d.ts +4 -5
- package/dist/node/utilities/apiRoutes.js +2 -8
- package/dist/node/utilities/fetch.d.ts +1 -2
- package/dist/node/utilities/fetch.js +1 -3
- package/dist/node/utilities/html-encoding.d.ts +1 -0
- package/dist/node/utilities/html-encoding.js +12 -0
- package/dist/node/utilities/index.d.ts +1 -0
- package/dist/node/utilities/index.js +3 -1
- package/dist/node/utilities/log/log-cache-api-status.js +5 -1
- package/dist/node/version.d.ts +1 -1
- package/dist/node/version.js +1 -1
- package/package.json +6 -5
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +48 -6
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +48 -6
- package/vendor/react-server-dom-vite/package.json +2 -1
- package/dist/esnext/components/ProductDescription/ProductDescription.client.d.ts +0 -13
- package/dist/esnext/components/ProductDescription/ProductDescription.client.js +0 -16
- package/dist/esnext/components/ProductDescription/index.d.ts +0 -1
- package/dist/esnext/components/ProductDescription/index.js +0 -1
- package/dist/esnext/components/ProductMetafield/ProductMetafield.client.d.ts +0 -21
- package/dist/esnext/components/ProductMetafield/ProductMetafield.client.js +0 -42
- package/dist/esnext/components/ProductMetafield/index.d.ts +0 -2
- package/dist/esnext/components/ProductMetafield/index.js +0 -1
- package/dist/esnext/components/ProductTitle/ProductTitle.client.d.ts +0 -13
- package/dist/esnext/components/ProductTitle/ProductTitle.client.js +0 -16
- package/dist/esnext/components/ProductTitle/index.d.ts +0 -1
- package/dist/esnext/components/ProductTitle/index.js +0 -1
- package/dist/esnext/components/UnitPrice/UnitPrice.client.d.ts +0 -15
- package/dist/esnext/components/UnitPrice/UnitPrice.client.js +0 -22
- package/dist/esnext/components/UnitPrice/index.d.ts +0 -1
- package/dist/esnext/components/UnitPrice/index.js +0 -1
- package/dist/esnext/utilities/findRoutePrefix.d.ts +0 -1
- package/dist/esnext/utilities/findRoutePrefix.js +0 -17
- package/dist/node/foundation/Analytics/index.d.ts +0 -2
- package/dist/node/foundation/Analytics/index.js +0 -7
- package/dist/node/utilities/findRoutePrefix.d.ts +0 -1
- package/dist/node/utilities/findRoutePrefix.js +0 -21
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ElementType } from 'react';
|
|
2
|
-
import { Props } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* The `ProductDescription` component renders a `div` with
|
|
5
|
-
* the product's [`descriptionHtml`](https://shopify.dev/api/storefront/reference/products/product).
|
|
6
|
-
* It must be a descendent of the `ProductProvider` component.
|
|
7
|
-
*/
|
|
8
|
-
export declare function ProductDescription<TTag extends ElementType = 'div'>(props: Props<TTag> & {
|
|
9
|
-
/** An HTML tag to wrap the description. If not specified, then the
|
|
10
|
-
* description is wrapped in a `div` element.
|
|
11
|
-
*/
|
|
12
|
-
as?: TTag;
|
|
13
|
-
}): JSX.Element | null;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useProduct } from '../ProductProvider';
|
|
3
|
-
/**
|
|
4
|
-
* The `ProductDescription` component renders a `div` with
|
|
5
|
-
* the product's [`descriptionHtml`](https://shopify.dev/api/storefront/reference/products/product).
|
|
6
|
-
* It must be a descendent of the `ProductProvider` component.
|
|
7
|
-
*/
|
|
8
|
-
export function ProductDescription(props) {
|
|
9
|
-
var _a;
|
|
10
|
-
const product = useProduct();
|
|
11
|
-
if (product == null) {
|
|
12
|
-
throw new Error('Expected a ProductProvider context, but none was found');
|
|
13
|
-
}
|
|
14
|
-
const Wrapper = (_a = props.as) !== null && _a !== void 0 ? _a : 'div';
|
|
15
|
-
return product.descriptionHtml ? (React.createElement(Wrapper, { dangerouslySetInnerHTML: { __html: product.descriptionHtml }, ...props })) : null;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ProductDescription } from './ProductDescription.client';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ProductDescription } from './ProductDescription.client';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ElementType } from 'react';
|
|
2
|
-
import { Props } from '../types';
|
|
3
|
-
import { MetafieldProps } from '../Metafield/Metafield.client';
|
|
4
|
-
export interface ProductMetafieldProps<TTag> extends Omit<MetafieldProps<TTag>, 'metafield'> {
|
|
5
|
-
/** A string corresponding to the [key](https://shopify.dev/api/storefront/reference/common-objects/metafield) of the product's
|
|
6
|
-
* metafield.
|
|
7
|
-
*/
|
|
8
|
-
keyName: string;
|
|
9
|
-
/** A string corresponding to the [namespace](https://shopify.dev/api/storefront/reference/common-objects/metafield) of the
|
|
10
|
-
* product's metafield.
|
|
11
|
-
*/
|
|
12
|
-
namespace: string;
|
|
13
|
-
/** The ID of the variant. If provided, then use the metafield corresponding to the variant ID instead of the product's metafield. */
|
|
14
|
-
variantId?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* The `ProductMetafield` component renders a
|
|
18
|
-
* [`Metafield`](https://shopify.dev/api/hydrogen/components/primitive/metafield) component with the product metafield.
|
|
19
|
-
* It must be a descendent of a `ProductProvider` component.
|
|
20
|
-
*/
|
|
21
|
-
export declare function ProductMetafield<TTag extends ElementType>(props: Props<TTag> & Omit<ProductMetafieldProps<TTag>, 'data'>): JSX.Element | null;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Metafield } from '../Metafield';
|
|
3
|
-
import { useProduct } from '../../hooks/useProduct/useProduct';
|
|
4
|
-
import { flattenConnection } from '../../utilities';
|
|
5
|
-
/**
|
|
6
|
-
* The `ProductMetafield` component renders a
|
|
7
|
-
* [`Metafield`](https://shopify.dev/api/hydrogen/components/primitive/metafield) component with the product metafield.
|
|
8
|
-
* It must be a descendent of a `ProductProvider` component.
|
|
9
|
-
*/
|
|
10
|
-
export function ProductMetafield(props) {
|
|
11
|
-
var _a, _b, _c;
|
|
12
|
-
const product = useProduct();
|
|
13
|
-
if (product == null) {
|
|
14
|
-
throw new Error('Expected a ProductProvider context, but none was found');
|
|
15
|
-
}
|
|
16
|
-
if (product.metafields == null) {
|
|
17
|
-
console.warn('No metafields available for product');
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const { namespace, keyName, variantId, ...passthroughProps } = props;
|
|
21
|
-
const metafields = (variantId
|
|
22
|
-
? flattenConnection((_c = (_b = (_a = product.variants) === null || _a === void 0 ? void 0 : _a.find((variant) => (variant === null || variant === void 0 ? void 0 : variant.id) === variantId)) === null || _b === void 0 ? void 0 : _b.metafields) !== null && _c !== void 0 ? _c : {})
|
|
23
|
-
: product.metafields); // TODO: fix the typing here and ensure it's correct
|
|
24
|
-
const field = metafields === null || metafields === void 0 ? void 0 : metafields.find((metafield) => metafield.namespace === namespace && metafield.key === keyName);
|
|
25
|
-
if (field === null || field === undefined) {
|
|
26
|
-
const message = 'does not have a value for metafield.';
|
|
27
|
-
const productOrVariant = variantId ? `Variant` : 'Product';
|
|
28
|
-
const logItems = {
|
|
29
|
-
variantId,
|
|
30
|
-
ProductId: product.id,
|
|
31
|
-
namespace,
|
|
32
|
-
keyName,
|
|
33
|
-
};
|
|
34
|
-
console.warn([
|
|
35
|
-
productOrVariant,
|
|
36
|
-
message,
|
|
37
|
-
...Object.entries(logItems).map(([key, val]) => `${key}: ${val}`),
|
|
38
|
-
].join(' '));
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
return React.createElement(Metafield, { data: field, ...passthroughProps });
|
|
42
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ProductMetafield } from './ProductMetafield.client';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ElementType } from 'react';
|
|
2
|
-
import { Props } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* The `ProductTitle` component renders a `span` element (or the type of
|
|
5
|
-
* HTML element specified by the `as` prop) with the product's [`title`](https://shopify.dev/api/storefront/reference/products/product).
|
|
6
|
-
* It must be a descendent of the `ProductProvider` component.
|
|
7
|
-
*/
|
|
8
|
-
export declare function ProductTitle<TTag extends ElementType = 'span'>(props: Props<TTag> & {
|
|
9
|
-
/** An HTML tag to wrap the title. If not specified, then the
|
|
10
|
-
* title is wrapped in a `span` element.
|
|
11
|
-
*/
|
|
12
|
-
as?: TTag;
|
|
13
|
-
}): JSX.Element | null;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useProduct } from '../ProductProvider';
|
|
3
|
-
/**
|
|
4
|
-
* The `ProductTitle` component renders a `span` element (or the type of
|
|
5
|
-
* HTML element specified by the `as` prop) with the product's [`title`](https://shopify.dev/api/storefront/reference/products/product).
|
|
6
|
-
* It must be a descendent of the `ProductProvider` component.
|
|
7
|
-
*/
|
|
8
|
-
export function ProductTitle(props) {
|
|
9
|
-
const product = useProduct();
|
|
10
|
-
if (product == null) {
|
|
11
|
-
throw new Error('Expected a ProductProvider context, but none was found');
|
|
12
|
-
}
|
|
13
|
-
const { as, ...passthroughProps } = props;
|
|
14
|
-
const Wrapper = as ? as : 'span';
|
|
15
|
-
return product.title ? (React.createElement(Wrapper, { ...passthroughProps }, product.title)) : null;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ProductTitle } from './ProductTitle.client';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ProductTitle } from './ProductTitle.client';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { UnitPriceMeasurement, MoneyV2 } from '../../storefront-api-types';
|
|
2
|
-
import type { PartialDeep } from 'type-fest';
|
|
3
|
-
export interface UnitPriceProps<TTag> {
|
|
4
|
-
/** An object with fields that correspond to the Storefront API's [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2). */
|
|
5
|
-
data: PartialDeep<MoneyV2>;
|
|
6
|
-
/** A [UnitPriceMeasurement object](https://shopify.dev/api/storefront/reference/products/unitpricemeasurement). */
|
|
7
|
-
measurement: PartialDeep<UnitPriceMeasurement>;
|
|
8
|
-
/** An HTML tag to be rendered as the base element wrapper. The default is `div`. */
|
|
9
|
-
as?: TTag;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* The `UnitPrice` component renders a string with a [UnitPrice](https://shopify.dev/themes/pricing-payments/unit-pricing) as the
|
|
13
|
-
* Storefront API's [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) with a reference unit from the Storefront API's [UnitPriceMeasurement object](/api/storefront/reference/products/unitpricemeasurement).
|
|
14
|
-
*/
|
|
15
|
-
export declare function UnitPrice<TTag extends keyof JSX.IntrinsicElements = 'div'>(props: JSX.IntrinsicElements[TTag] & UnitPriceProps<TTag>): JSX.Element | null;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Money } from '../Money';
|
|
3
|
-
/**
|
|
4
|
-
* The `UnitPrice` component renders a string with a [UnitPrice](https://shopify.dev/themes/pricing-payments/unit-pricing) as the
|
|
5
|
-
* Storefront API's [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) with a reference unit from the Storefront API's [UnitPriceMeasurement object](/api/storefront/reference/products/unitpricemeasurement).
|
|
6
|
-
*/
|
|
7
|
-
export function UnitPrice(props) {
|
|
8
|
-
const { data, measurement, as, ...passthroughProps } = props;
|
|
9
|
-
if (!data) {
|
|
10
|
-
console.warn(`No "data" prop was passed to <UnitPrice/>`);
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
if (!measurement) {
|
|
14
|
-
console.warn(`No "measurement" prop was passed to <UnitPrice/>`);
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const Wrapper = as !== null && as !== void 0 ? as : 'div';
|
|
18
|
-
return (React.createElement(Wrapper, { ...passthroughProps },
|
|
19
|
-
React.createElement(Money, { data: data }),
|
|
20
|
-
"/",
|
|
21
|
-
measurement.referenceUnit));
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { UnitPrice } from './UnitPrice.client';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { UnitPrice } from './UnitPrice.client';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function findRoutePrefix([first, ...rest]: string[]): string | RegExp;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const DEFAULT_ROUTE_PREFIX = /^\.(\/src)?\/routes/;
|
|
2
|
-
export function findRoutePrefix([first, ...rest]) {
|
|
3
|
-
if (!(first === null || first === void 0 ? void 0 : first.startsWith('./')))
|
|
4
|
-
return '';
|
|
5
|
-
let commonPrefix = '.';
|
|
6
|
-
if (rest.length > 0) {
|
|
7
|
-
const parts = first.split('/');
|
|
8
|
-
parts.pop(); // Last part is always different and has extension
|
|
9
|
-
for (const string of rest) {
|
|
10
|
-
const tmp = string.split('/');
|
|
11
|
-
const diffIndex = parts.findIndex((part, index) => part !== tmp[index]);
|
|
12
|
-
diffIndex >= 0 && parts.splice(diffIndex);
|
|
13
|
-
}
|
|
14
|
-
commonPrefix = parts.join('/');
|
|
15
|
-
}
|
|
16
|
-
return commonPrefix === '.' ? DEFAULT_ROUTE_PREFIX : commonPrefix;
|
|
17
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClientAnalytics = exports.useServerAnalytics = void 0;
|
|
4
|
-
var hook_1 = require("./hook");
|
|
5
|
-
Object.defineProperty(exports, "useServerAnalytics", { enumerable: true, get: function () { return hook_1.useServerAnalytics; } });
|
|
6
|
-
var ClientAnalytics_1 = require("./ClientAnalytics");
|
|
7
|
-
Object.defineProperty(exports, "ClientAnalytics", { enumerable: true, get: function () { return ClientAnalytics_1.ClientAnalytics; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function findRoutePrefix([first, ...rest]: string[]): string | RegExp;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findRoutePrefix = void 0;
|
|
4
|
-
const DEFAULT_ROUTE_PREFIX = /^\.(\/src)?\/routes/;
|
|
5
|
-
function findRoutePrefix([first, ...rest]) {
|
|
6
|
-
if (!(first === null || first === void 0 ? void 0 : first.startsWith('./')))
|
|
7
|
-
return '';
|
|
8
|
-
let commonPrefix = '.';
|
|
9
|
-
if (rest.length > 0) {
|
|
10
|
-
const parts = first.split('/');
|
|
11
|
-
parts.pop(); // Last part is always different and has extension
|
|
12
|
-
for (const string of rest) {
|
|
13
|
-
const tmp = string.split('/');
|
|
14
|
-
const diffIndex = parts.findIndex((part, index) => part !== tmp[index]);
|
|
15
|
-
diffIndex >= 0 && parts.splice(diffIndex);
|
|
16
|
-
}
|
|
17
|
-
commonPrefix = parts.join('/');
|
|
18
|
-
}
|
|
19
|
-
return commonPrefix === '.' ? DEFAULT_ROUTE_PREFIX : commonPrefix;
|
|
20
|
-
}
|
|
21
|
-
exports.findRoutePrefix = findRoutePrefix;
|