@wix/site-service-rendering-context 1.0.4 → 1.0.6

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 CHANGED
@@ -5,7 +5,7 @@ Service exposing rendering-context flags (`SSR`, `SEO`) as a dedicated site-serv
5
5
  ## Install
6
6
 
7
7
  ```sh
8
- yarn add @wix/site-service-rendering-context
8
+ pnpm add @wix/site-service-rendering-context
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -1,9 +1,39 @@
1
1
  import type { ServiceDefinition } from '@wix/services-definitions';
2
+ /** Values the host supplies when it creates the service. */
2
3
  export type IRenderingContextServiceConfig = {
4
+ /**
5
+ * Whether the current page request comes from a search engine crawler.
6
+ *
7
+ * Default: `false`
8
+ */
3
9
  readonly seo?: boolean;
4
10
  };
11
+ /**
12
+ * Reports whether code is running without a browser window, and whether the page is rendering for
13
+ * a search engine crawler.
14
+ */
5
15
  export interface IRenderingContextService {
16
+ /**
17
+ * Whether the code is running without a browser window, such as while the page renders on the server.
18
+ *
19
+ * This is `true` wherever there's no global `window`, which includes a web worker as well as the
20
+ * server. It's `false` in a browser window.
21
+ *
22
+ * It doesn't change while your code runs. It stays `true` for the whole server render, and `false`
23
+ * for as long as the page is open in the browser. Don't use it to choose what a component renders,
24
+ * because the server HTML won't match the browser render. Put browser-only work in an effect or an
25
+ * event handler instead.
26
+ *
27
+ * @exampleValue false
28
+ */
6
29
  readonly SSR: boolean;
30
+ /**
31
+ * Whether the page is rendering for a search engine crawler.
32
+ *
33
+ * It's set for each page request, not by a site setting. It doesn't change while your code runs.
34
+ *
35
+ * @exampleValue false
36
+ */
7
37
  readonly SEO: boolean;
8
38
  }
9
39
  export type IRenderingContextDefinition = ServiceDefinition<IRenderingContextService, IRenderingContextServiceConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AAc5C,QAAA,0BAA0B,GAAG,IAAA,oCAAa,EACtD,qCAAqC,CACrC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AA4C5C,QAAA,0BAA0B,GAAG,IAAA,oCAAa,EACtD,qCAAqC,CACrC,CAAA"}
@@ -1,9 +1,39 @@
1
1
  import type { ServiceDefinition } from '@wix/services-definitions';
2
+ /** Values the host supplies when it creates the service. */
2
3
  export type IRenderingContextServiceConfig = {
4
+ /**
5
+ * Whether the current page request comes from a search engine crawler.
6
+ *
7
+ * Default: `false`
8
+ */
3
9
  readonly seo?: boolean;
4
10
  };
11
+ /**
12
+ * Reports whether code is running without a browser window, and whether the page is rendering for
13
+ * a search engine crawler.
14
+ */
5
15
  export interface IRenderingContextService {
16
+ /**
17
+ * Whether the code is running without a browser window, such as while the page renders on the server.
18
+ *
19
+ * This is `true` wherever there's no global `window`, which includes a web worker as well as the
20
+ * server. It's `false` in a browser window.
21
+ *
22
+ * It doesn't change while your code runs. It stays `true` for the whole server render, and `false`
23
+ * for as long as the page is open in the browser. Don't use it to choose what a component renders,
24
+ * because the server HTML won't match the browser render. Put browser-only work in an effect or an
25
+ * event handler instead.
26
+ *
27
+ * @exampleValue false
28
+ */
6
29
  readonly SSR: boolean;
30
+ /**
31
+ * Whether the page is rendering for a search engine crawler.
32
+ *
33
+ * It's set for each page request, not by a site setting. It doesn't change while your code runs.
34
+ *
35
+ * @exampleValue false
36
+ */
7
37
  readonly SEO: boolean;
8
38
  }
9
39
  export type IRenderingContextDefinition = ServiceDefinition<IRenderingContextService, IRenderingContextServiceConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAczD,MAAM,CAAC,MAAM,0BAA0B,GAAG,aAAa,CACtD,qCAAqC,CACrC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AA4CzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,aAAa,CACtD,qCAAqC,CACrC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/site-service-rendering-context",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "dist",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "scripts": {
50
50
  "build": "tsc -b . && tsc --project tsconfig.cjs.json",
51
- "lint": "yarn run -T lint:package $npm_package_name",
52
- "test": "vitest --run && yarn test-type-check",
51
+ "lint": "pnpm --workspace-root run lint:package --package $npm_package_name",
52
+ "test": "vitest --run && pnpm run test-type-check",
53
53
  "test-type-check": "echo 'validating typescript in test files' && tsc --project tsconfig.test.json && echo 'Finished validating typescript in test files successfully'"
54
54
  },
55
55
  "dependencies": {
@@ -77,5 +77,5 @@
77
77
  ]
78
78
  }
79
79
  },
80
- "falconPackageHash": "7b15411dfb9085e495332afe40b062694a43e8242a094d50c932dab1"
80
+ "falconPackageHash": "244c167b728f70a386d3ad700fbfdb36804b33cbb563953a0c98927e"
81
81
  }
@@ -1,12 +1,42 @@
1
1
  import { defineService } from '@wix/services-definitions'
2
2
  import type { ServiceDefinition } from '@wix/services-definitions'
3
3
 
4
+ /** Values the host supplies when it creates the service. */
4
5
  export type IRenderingContextServiceConfig = {
6
+ /**
7
+ * Whether the current page request comes from a search engine crawler.
8
+ *
9
+ * Default: `false`
10
+ */
5
11
  readonly seo?: boolean
6
12
  }
7
13
 
14
+ /**
15
+ * Reports whether code is running without a browser window, and whether the page is rendering for
16
+ * a search engine crawler.
17
+ */
8
18
  export interface IRenderingContextService {
19
+ /**
20
+ * Whether the code is running without a browser window, such as while the page renders on the server.
21
+ *
22
+ * This is `true` wherever there's no global `window`, which includes a web worker as well as the
23
+ * server. It's `false` in a browser window.
24
+ *
25
+ * It doesn't change while your code runs. It stays `true` for the whole server render, and `false`
26
+ * for as long as the page is open in the browser. Don't use it to choose what a component renders,
27
+ * because the server HTML won't match the browser render. Put browser-only work in an effect or an
28
+ * event handler instead.
29
+ *
30
+ * @exampleValue false
31
+ */
9
32
  readonly SSR: boolean
33
+ /**
34
+ * Whether the page is rendering for a search engine crawler.
35
+ *
36
+ * It's set for each page request, not by a site setting. It doesn't change while your code runs.
37
+ *
38
+ * @exampleValue false
39
+ */
10
40
  readonly SEO: boolean
11
41
  }
12
42