Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin): create plugin to integrate modules #462

Merged
merged 41 commits into from Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e905aaa
feat(plugin): create plugin to integrate widgets
dsurducan Jan 10, 2024
5cbbbb3
Auto generated documentation
github-actions[bot] Jan 10, 2024
a64777c
Merge branch 'main' into widgets-build
dsurducan Jan 10, 2024
ab0d0d6
addressed pr comments
dsurducan Jan 11, 2024
c2c133b
Auto generated documentation
github-actions[bot] Jan 11, 2024
ce74a43
removed document param from widgetprops
dsurducan Jan 11, 2024
068a5ea
Auto generated documentation
github-actions[bot] Jan 11, 2024
7ecf67d
update parse function and move internal widget types file
dsurducan Jan 11, 2024
0337113
fix documentation, remove logs, remove async
dsurducan Jan 12, 2024
34134ee
Auto generated documentation
github-actions[bot] Jan 12, 2024
08b16f1
separate build per widget
dsurducan Jan 12, 2024
31d516e
Merge branch 'main' into widgets-build
dsurducan Jan 16, 2024
b9e7fbd
specify unique tailwind config for each widget
dsurducan Jan 17, 2024
dde72a0
plugin config
asanehisa Feb 14, 2024
b1c3b51
Auto generated documentation
github-actions[bot] Feb 14, 2024
24ae3ef
works w/ document
asanehisa Feb 14, 2024
967d14b
Merge branch 'main' into widgets-build
asanehisa Feb 14, 2024
7e27d86
Auto generated documentation
github-actions[bot] Feb 14, 2024
ba1374c
tests
asanehisa Feb 15, 2024
0f4c0b6
config yaml response headers work
asanehisa Feb 15, 2024
152ceb5
dont have to wrap widget code on client end
asanehisa Feb 15, 2024
5b6b3ef
wrapping works!
asanehisa Feb 15, 2024
a0b0637
add tests
asanehisa Feb 20, 2024
3336ce0
clean up a bit
asanehisa Feb 20, 2024
3a4ed01
widgets -> modules rename
asanehisa Feb 20, 2024
798d2e6
Auto generated documentation
github-actions[bot] Feb 20, 2024
951172f
confirmed works locally, address comments
asanehisa Feb 20, 2024
c0b9cac
Auto generated documentation
github-actions[bot] Feb 20, 2024
ea018a2
fix tests
asanehisa Feb 21, 2024
b18ffd6
address more comments
asanehisa Feb 21, 2024
8c756f0
add scoping plugin
asanehisa Feb 22, 2024
8ecb96a
updated plugin
asanehisa Feb 22, 2024
5f4b52d
Automated update to THIRD-PARTY-NOTICES from github action's 3rd part…
github-actions[bot] Feb 22, 2024
c87f417
Merge branch 'main' into widgets-build
asanehisa Feb 22, 2024
6673926
addressed comments
asanehisa Feb 26, 2024
7f7767f
Automated update to THIRD-PARTY-NOTICES from github action's 3rd part…
github-actions[bot] Feb 26, 2024
7385ea2
transform in rollup
asanehisa Feb 28, 2024
2eee8e8
address comments
asanehisa Feb 29, 2024
be3f42b
fix tailwind / css issues
asanehisa Feb 29, 2024
dd4e21d
remove plugin from package.json
asanehisa Feb 29, 2024
befea13
Automated update to THIRD-PARTY-NOTICES from github action's 3rd part…
github-actions[bot] Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
63 changes: 62 additions & 1 deletion THIRD-PARTY-NOTICES
Expand Up @@ -7001,6 +7001,37 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

-----------

The following npm package may be included in this product:

- postcss-selector-parser@6.0.13

This package contains the following license and notice below:

Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

-----------

The following npm package may be included in this product:

- entities@2.2.0
Expand Down Expand Up @@ -7231,6 +7262,7 @@ IN THE SOFTWARE.

The following npm packages may be included in this product:

- cssesc@3.0.0
- emoji-regex@10.2.1
- punycode@1.3.2

Expand Down Expand Up @@ -10568,7 +10600,7 @@ THE SOFTWARE.

The following npm package may be included in this product:

- postcss@8.4.32
- postcss@8.4.35

This package contains the following license and notice below:

Expand All @@ -10595,6 +10627,35 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-----------

The following npm package may be included in this product:

- postcss-nested@6.0.1

This package contains the following license and notice below:

The MIT License (MIT)

Copyright 2014 Andrey Sitnik <andrey@sitnik.ru>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-----------

The following npm package may be included in this product:

- nanoid@3.3.7
Expand Down
17 changes: 9 additions & 8 deletions package.json
Expand Up @@ -38,29 +38,30 @@
"@types/fs-extra": "^11.0.4",
"@types/lodash": "^4.14.202",
"@types/minimist": "^1.2.5",
"@types/node": "^20.10.6",
"@types/prompts": "^2.4.9",
"@types/semver": "^7.5.6",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-react": "^7.33.2",
"execa": "^8.0.1",
"fs-extra": "^11.2.0",
"yaml": "^2.3.4",
"generate-changelog": "^1.8.0",
"generate-license-file": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"minimist": "^1.2.8",
"picocolors": "^1.0.0",
"prettier": "^3.1.0",
"prompts": "^2.4.2",
"semver": "^7.5.4",
"tsx": "^4.6.2",
"typescript": "^5.3.3",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-react": "^7.33.2",
"tsx": "^4.6.2"
"yaml": "^2.3.4"
},
"packageManager": "pnpm@8.3.1",
"pnpm": {
Expand Down
58 changes: 58 additions & 0 deletions packages/pages/THIRD-PARTY-NOTICES
Expand Up @@ -5170,5 +5170,63 @@ SOFTWARE.

-----------

The following npm package may be included in this product:

- postcss@8.4.35

This package contains the following license and notice below:

The MIT License (MIT)

Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-----------

The following npm package may be included in this product:

- postcss-nested@6.0.1

This package contains the following license and notice below:

The MIT License (MIT)

Copyright 2014 Andrey Sitnik <andrey@sitnik.ru>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-----------

This file was generated with the generate-license-file npm package!
https://www.npmjs.com/package/generate-license-file
3 changes: 3 additions & 0 deletions packages/pages/docs/api/pages.md
Expand Up @@ -10,6 +10,8 @@
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [FunctionModule](./pages.functionmodule.md) | Defines the functions and fields that are available to the serverless function. |
| [HeadConfig](./pages.headconfig.md) | The configuration that allows users to entirely arbitarily set the inner contents of the head element that will be prepended to the generated HTML document. |
| [ModuleConfig](./pages.moduleconfig.md) | The configuration options for a Module. |
| [ModuleProps](./pages.moduleprops.md) | The shape of the data passed directly to the module's default export. |
| [PagesHttpRequest](./pages.pageshttprequest.md) | The argument passed to a http/api type function. |
| [PagesHttpResponse](./pages.pageshttpresponse.md) | The return value for a http/api serverless function. |
| [PagesOnUrlChangeRequest](./pages.pagesonurlchangerequest.md) | The argument passed to an onUrlChange type plugin. |
Expand Down Expand Up @@ -41,6 +43,7 @@
| [GetRedirects](./pages.getredirects.md) | The type definiton for the template's getRedirects function. |
| [HttpFunction](./pages.httpfunction.md) | A function that runs when a specific path is visited on the site. |
| [Manifest](./pages.manifest.md) | A manifest of bundled files present during a production build. |
| [Module](./pages.module.md) | The type definition for the module's default function. |
| [OnUrlChangeFunction](./pages.onurlchangefunction.md) | A function that runs when the path of a production page changes. |
| [PagesOnUrlChangeResponse](./pages.pagesonurlchangeresponse.md) | onUrlUpdate plugins return void. |
| [Render](./pages.render.md) | The type definition for the template's render function. |
Expand Down
13 changes: 13 additions & 0 deletions packages/pages/docs/api/pages.module.md
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/pages](./pages.md) &gt; [Module](./pages.module.md)

## Module type

The type definition for the module's default function.

**Signature:**

```typescript
export type Module = () => React.JSX.Element;
```
19 changes: 19 additions & 0 deletions packages/pages/docs/api/pages.moduleconfig.md
@@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/pages](./pages.md) &gt; [ModuleConfig](./pages.moduleconfig.md)

## ModuleConfig interface

The configuration options for a Module.

**Signature:**

```typescript
export interface ModuleConfig
```

## Properties

| Property | Modifiers | Type | Description |
| ------------------------------------- | --------- | ------ | -------------------------------------------------------------------------------------------- |
| [name?](./pages.moduleconfig.name.md) | | string | _(Optional)_ Name of the module. If not defined uses the module filename (without extension) |
13 changes: 13 additions & 0 deletions packages/pages/docs/api/pages.moduleconfig.name.md
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/pages](./pages.md) &gt; [ModuleConfig](./pages.moduleconfig.md) &gt; [name](./pages.moduleconfig.name.md)

## ModuleConfig.name property

Name of the module. If not defined uses the module filename (without extension)

**Signature:**

```typescript
name?: string;
```
15 changes: 15 additions & 0 deletions packages/pages/docs/api/pages.moduleprops.__meta.md
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/pages](./pages.md) &gt; [ModuleProps](./pages.moduleprops.md) &gt; [\_\_meta](./pages.moduleprops.__meta.md)

## ModuleProps.\_\_meta property

Additional metadata added by the toolchain

**Signature:**

```typescript
__meta: {
mode: "development" | "production";
}
```
19 changes: 19 additions & 0 deletions packages/pages/docs/api/pages.moduleprops.md
@@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/pages](./pages.md) &gt; [ModuleProps](./pages.moduleprops.md)

## ModuleProps interface

The shape of the data passed directly to the module's default export.

**Signature:**

```typescript
export interface ModuleProps
```

## Properties

| Property | Modifiers | Type | Description |
| ----------------------------------------- | --------- | ---------------------------------------- | ------------------------------------------ |
| [\_\_meta](./pages.moduleprops.__meta.md) | | { mode: "development" \| "production"; } | Additional metadata added by the toolchain |
15 changes: 15 additions & 0 deletions packages/pages/etc/pages.api.md
Expand Up @@ -91,6 +91,21 @@ export type Manifest = {
bundlerManifest?: any;
};

// @public
export type Module = () => React.JSX.Element;

// @public
export interface ModuleConfig {
name?: string;
}

// @public
export interface ModuleProps {
__meta: {
mode: "development" | "production";
};
}

// @public
export type OnUrlChangeFunction = (
arg: PagesOnUrlChangeRequest
Expand Down
2 changes: 2 additions & 0 deletions packages/pages/package.json
Expand Up @@ -75,6 +75,8 @@
"open": "^9.1.0",
"ora": "^7.0.1",
"picocolors": "^1.0.0",
"postcss": "8.4.35",
"postcss-nested": "6.0.1",
"pretty-ms": "^8.0.0",
"prompts": "^2.4.2",
"rollup": "^4.7.0",
Expand Down
29 changes: 29 additions & 0 deletions packages/pages/src/common/src/module/types.ts
@@ -0,0 +1,29 @@
/**
* The type definition for the module's default function.
*
* @public
*/
export type Module = () => React.JSX.Element;

/**
* The configuration options for a Module.
*
* @public
*/
export interface ModuleConfig {
/** Name of the module. If not defined uses the module filename (without extension) */
name?: string;
}

/**
* The shape of the data passed directly to the module's default export.
*
* @public
*/
export interface ModuleProps {
/** Additional metadata added by the toolchain */
__meta: {
/** Specifies if the data is returned in development or production mode */
mode: "development" | "production";
};
}