@sharadox/next-js-configuration-web-library 0.0.0-stage → 0.1.0

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/LICENCA.md ADDED
@@ -0,0 +1,76 @@
1
+ # Licença Sharadox de Código Aberto
2
+
3
+ Versão 0.1.0
4
+
5
+ O texto em língua portuguesa é o único texto original e vinculativo desta licença. A tradução para inglês (`LICENSE.md`) é meramente informativa; em caso de divergência prevalece o texto em português.
6
+
7
+ ## 1. Definições
8
+
9
+ Para efeitos desta licença:
10
+
11
+ 1. **«Obra»** — o programa de computador, a sua documentação e quaisquer outros conteúdos disponibilizados pelo Licenciante ao abrigo desta licença, em código-fonte ou em qualquer outra forma.
12
+ 2. **«Licenciante»** — o titular dos direitos de autor identificado no aviso de direitos de autor que acompanha a Obra.
13
+ 3. **«Licenciado»** — qualquer pessoa, singular ou coletiva, que exerça os direitos concedidos por esta licença.
14
+ 4. **«Obra Derivada»** — qualquer obra baseada na Obra ou que a incorpore, total ou parcialmente, com ou sem modificações, incluindo traduções, adaptações e programas que a integrem.
15
+ 5. **«Aviso»** — o aviso de direitos de autor do Licenciante e a indicação de que a Obra está licenciada ao abrigo desta licença, incluindo a respetiva versão.
16
+
17
+ ## 2. Concessão de direitos
18
+
19
+ 1. Nos termos desta licença, o Licenciante concede ao Licenciado uma licença mundial, gratuita, não exclusiva e por todo o prazo de proteção dos direitos de autor para:
20
+ 1. utilizar a Obra para qualquer finalidade, incluindo finalidades comerciais;
21
+ 2. reproduzir a Obra, total ou parcialmente, por qualquer meio e sob qualquer forma;
22
+ 3. modificar, traduzir, adaptar e transformar a Obra e criar Obras Derivadas;
23
+ 4. distribuir, publicar, comunicar ao público, colocar à disposição, vender e sublicenciar a Obra e as Obras Derivadas.
24
+ 2. Na medida em que o Licenciante seja titular de patentes necessariamente infringidas pela Obra tal como por si disponibilizada, concede igualmente ao Licenciado, nos mesmos termos, uma licença para utilizar essas patentes no exercício dos direitos previstos no número anterior.
25
+ 3. Esta licença não transmite a titularidade de quaisquer direitos, que permanecem do Licenciante.
26
+
27
+ ## 3. Condições
28
+
29
+ O exercício dos direitos concedidos fica sujeito às seguintes condições:
30
+
31
+ 1. Todas as cópias da Obra, ou de partes substanciais da mesma, e todas as Obras Derivadas distribuídas devem incluir o Aviso e uma cópia desta licença ou uma ligação estável para o seu texto.
32
+ 2. Quem distribuir uma versão modificada da Obra deve indicar de forma visível que a mesma foi modificada, não podendo apresentá-la como versão original do Licenciante.
33
+ 3. O Licenciado pode licenciar as suas próprias modificações ao abrigo de outros termos, desde que a parte da Obra que delas faça parte continue sujeita às condições desta licença.
34
+
35
+ ## 4. Nomes e marcas
36
+
37
+ Esta licença não concede qualquer direito sobre o nome, as marcas, os logótipos ou outros sinais distintivos do Licenciante, incluindo a designação «Sharadox», salvo na medida estritamente necessária para cumprir o dever de incluir o Aviso. É proibido utilizá-los para promover ou sugerir o apoio do Licenciante a Obras Derivadas ou a quaisquer produtos ou serviços sem autorização prévia e escrita.
38
+
39
+ ## 5. Exclusão de garantias
40
+
41
+ A Obra é disponibilizada «tal como está» e «conforme disponível», sem qualquer garantia, expressa ou tácita, incluindo, designadamente, garantias de comerciabilidade, de adequação a um fim específico, de ausência de erros ou de não violação de direitos de terceiros, na medida máxima permitida pela lei aplicável.
42
+
43
+ ## 6. Limitação de responsabilidade
44
+
45
+ 1. Na medida máxima permitida pela lei aplicável, o Licenciante não é responsável por quaisquer danos, diretos ou indiretos, incluindo lucros cessantes, perda de dados ou interrupção de atividade, resultantes da utilização ou da impossibilidade de utilização da Obra, ainda que tenha sido avisado da possibilidade da sua ocorrência.
46
+ 2. Nada nesta licença exclui ou limita a responsabilidade do Licenciante nos casos em que tal exclusão ou limitação não seja permitida por lei, designadamente por atos praticados com dolo ou culpa grave, nos termos do artigo 809.º e do n.º 2 do artigo 800.º do Código Civil, nem afeta os direitos que a lei imperativamente reconheça aos consumidores.
47
+
48
+ ## 7. Cessação
49
+
50
+ 1. Os direitos concedidos por esta licença cessam automaticamente se o Licenciado violar qualquer das suas condições.
51
+ 2. Os direitos são repostos se a violação for sanada no prazo de 30 dias a contar do momento em que o Licenciado dela tome conhecimento, salvo se o Licenciante tiver entretanto comunicado por escrito a sua oposição.
52
+ 3. A cessação não afeta as licenças validamente concedidas pelo Licenciado a terceiros que cumpram esta licença.
53
+
54
+ ## 8. Lei aplicável e foro
55
+
56
+ 1. Esta licença rege-se pela lei portuguesa, designadamente pelo Código do Direito de Autor e dos Direitos Conexos, aprovado pelo Decreto-Lei n.º 63/85, de 14 de março, e pelo Decreto-Lei n.º 252/94, de 20 de outubro, relativo à proteção jurídica dos programas de computador.
57
+ 2. Para a resolução de quaisquer litígios emergentes desta licença é competente o Tribunal Judicial da Comarca de Faro, sem prejuízo das normas imperativas de competência aplicáveis, nomeadamente as que protegem os consumidores.
58
+
59
+ ## 9. Versões da licença
60
+
61
+ O Licenciante pode publicar novas versões desta licença, identificadas por um número de versão. A Obra fica sujeita à versão indicada no Aviso. O Licenciado pode, se o Aviso o permitir, optar por qualquer versão posterior.
62
+
63
+ ## 10. Disposições finais
64
+
65
+ 1. Se alguma disposição desta licença for considerada inválida ou ineficaz, as restantes mantêm-se em vigor, devendo a disposição afetada ser interpretada de forma a aproximar-se, tanto quanto possível, da intenção original.
66
+ 2. A não exigência, em qualquer momento, do cumprimento de uma disposição desta licença não constitui renúncia ao direito de o exigir posteriormente.
67
+
68
+ ## Como aplicar esta licença
69
+
70
+ Inclua na Obra um ficheiro `LICENCA.md` com este texto, a tradução `LICENSE.md` e o seguinte aviso, preenchendo o ano e o titular:
71
+
72
+ ```
73
+ Direitos de autor © <ano> <titular>.
74
+ Licenciado ao abrigo da Licença Sharadox de Código Aberto, versão 0.1.0.
75
+ https://github.com/Sharadox/sharadox-open-source-license
76
+ ```
package/LICENSE.md ADDED
@@ -0,0 +1,76 @@
1
+ # Sharadox Open Source Licence
2
+
3
+ Version 0.1.0
4
+
5
+ This is an informative English translation. The Portuguese text (`LICENCA.md`) is the only original and binding text of this licence; if the two differ, the Portuguese text prevails.
6
+
7
+ ## 1. Definitions
8
+
9
+ For the purposes of this licence:
10
+
11
+ 1. **"Work"** — the computer program, its documentation and any other content made available by the Licensor under this licence, in source code or in any other form.
12
+ 2. **"Licensor"** — the copyright holder identified in the copyright notice that accompanies the Work.
13
+ 3. **"Licensee"** — any natural or legal person exercising the rights granted by this licence.
14
+ 4. **"Derivative Work"** — any work based on or incorporating the Work, in whole or in part, with or without modifications, including translations, adaptations and programs that integrate it.
15
+ 5. **"Notice"** — the Licensor's copyright notice and the statement that the Work is licensed under this licence, including its version.
16
+
17
+ ## 2. Grant of rights
18
+
19
+ 1. Under this licence, the Licensor grants the Licensee a worldwide, royalty-free, non-exclusive licence, for the whole term of copyright protection, to:
20
+ 1. use the Work for any purpose, including commercial purposes;
21
+ 2. reproduce the Work, in whole or in part, by any means and in any form;
22
+ 3. modify, translate, adapt and transform the Work and create Derivative Works;
23
+ 4. distribute, publish, communicate to the public, make available, sell and sublicense the Work and Derivative Works.
24
+ 2. To the extent the Licensor holds patents necessarily infringed by the Work as made available by it, the Licensor also grants the Licensee, on the same terms, a licence to use those patents in exercising the rights in the previous paragraph.
25
+ 3. This licence does not transfer ownership of any rights, which remain with the Licensor.
26
+
27
+ ## 3. Conditions
28
+
29
+ The exercise of the rights granted is subject to the following conditions:
30
+
31
+ 1. Every copy of the Work, or of substantial parts of it, and every distributed Derivative Work must include the Notice and a copy of this licence or a stable link to its text.
32
+ 2. Anyone distributing a modified version of the Work must state visibly that it has been modified and may not present it as the Licensor's original version.
33
+ 3. The Licensee may license their own modifications under other terms, provided the part of the Work included in them remains subject to the conditions of this licence.
34
+
35
+ ## 4. Names and trademarks
36
+
37
+ This licence grants no rights to the Licensor's name, trademarks, logos or other distinctive signs, including the name "Sharadox", except as strictly necessary to comply with the duty to include the Notice. Using them to promote or suggest the Licensor's endorsement of Derivative Works or of any products or services without prior written permission is prohibited.
38
+
39
+ ## 5. Disclaimer of warranties
40
+
41
+ The Work is provided "as is" and "as available", without any warranty, express or implied, including in particular warranties of merchantability, fitness for a particular purpose, absence of errors or non-infringement of third-party rights, to the maximum extent permitted by applicable law.
42
+
43
+ ## 6. Limitation of liability
44
+
45
+ 1. To the maximum extent permitted by applicable law, the Licensor is not liable for any damages, direct or indirect, including loss of profits, loss of data or business interruption, arising from the use of or inability to use the Work, even if advised of the possibility of such damages.
46
+ 2. Nothing in this licence excludes or limits the Licensor's liability where such exclusion or limitation is not permitted by law, in particular for acts committed with intent or gross negligence, under article 809 and article 800(2) of the Portuguese Civil Code, nor does it affect rights that the law mandatorily grants to consumers.
47
+
48
+ ## 7. Termination
49
+
50
+ 1. The rights granted by this licence terminate automatically if the Licensee breaches any of its conditions.
51
+ 2. The rights are reinstated if the breach is remedied within 30 days of the Licensee becoming aware of it, unless the Licensor has meanwhile objected in writing.
52
+ 3. Termination does not affect licences validly granted by the Licensee to third parties who comply with this licence.
53
+
54
+ ## 8. Governing law and jurisdiction
55
+
56
+ 1. This licence is governed by Portuguese law, in particular the Code of Copyright and Related Rights, approved by Decree-Law no. 63/85 of 14 March, and Decree-Law no. 252/94 of 20 October on the legal protection of computer programs.
57
+ 2. The Judicial Court of the District of Faro has jurisdiction over any dispute arising from this licence, without prejudice to applicable mandatory rules of jurisdiction, in particular those protecting consumers.
58
+
59
+ ## 9. Licence versions
60
+
61
+ The Licensor may publish new versions of this licence, identified by a version number. The Work is subject to the version stated in the Notice. If the Notice allows it, the Licensee may choose any later version.
62
+
63
+ ## 10. Final provisions
64
+
65
+ 1. If any provision of this licence is held invalid or unenforceable, the remaining provisions stay in force, and the affected provision shall be interpreted as closely as possible to its original intent.
66
+ 2. Failure to enforce any provision of this licence at any time does not waive the right to enforce it later.
67
+
68
+ ## How to apply this licence
69
+
70
+ Include in the Work a `LICENCA.md` file with the Portuguese text, this translation as `LICENSE.md`, and the following notice, filling in the year and holder:
71
+
72
+ ```
73
+ Direitos de autor © <ano> <titular>.
74
+ Licenciado ao abrigo da Licença Sharadox de Código Aberto, versão 0.1.0.
75
+ https://github.com/Sharadox/sharadox-open-source-license
76
+ ```
package/NOTICE.md ADDED
@@ -0,0 +1,3 @@
1
+ Direitos de autor © 2026 Micael Pires (Sharadox).
2
+ Licenciado ao abrigo da Licença Sharadox de Código Aberto, versão 0.1.0.
3
+ https://github.com/Sharadox/sharadox-open-source-license
package/README.md CHANGED
@@ -1,3 +1,47 @@
1
- # Temporary Holding Version
1
+ # @sharadox/next-js-configuration-web-library
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Next.js configuration every Sharadox-style application shares, in one call:
4
+
5
+ - **Sass:** `src/` and the site library's `distribution/` are on the load path, so `@use "style/token"` finds the library's design helpers.
6
+ - **Languages:** `/` redirects to the language the visitor picked before, then their browser's, then the default (`@sharadox/internationalization-web-library`).
7
+ - **Security headers on every page:** `nosniff`, a strict referrer policy, no framing, no camera, microphone, geolocation or payment.
8
+ - **Real domain only:** once the site has its own domain, every `*.vercel.app` address (the project alias and each deployment) redirects permanently to the same path on it.
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ pnpm add -D @sharadox/next-js-configuration-web-library
14
+ ```
15
+
16
+ ## Use
17
+
18
+ ```ts
19
+ // next.config.ts
20
+ import { defineNextConfiguration } from "@sharadox/next-js-configuration-web-library/next-configuration";
21
+ import { LOCALES } from "@sharadox/sharadox-web-library/content/locale";
22
+
23
+ export default defineNextConfiguration({
24
+ root: new URL("./", import.meta.url),
25
+ styleLibrary: "@sharadox/sharadox-web-library",
26
+ locales: LOCALES,
27
+ productionDomain: "sharadox.com", // leave out while the site lives on <project>.vercel.app
28
+ });
29
+ ```
30
+
31
+ Anything else for Next.js goes in `next`. It's merged over these settings, and its `redirects()` and `headers()` are added after them.
32
+
33
+ ## API
34
+
35
+ | Import | Export |
36
+ | ---------------------- | -------------------------------------------------------------------------------------- |
37
+ | `…/next-configuration` | `defineNextConfiguration({ root, styleLibrary?, locales?, productionDomain?, next? })` |
38
+ | `…/domain-redirect` | `vercelAppRedirect(productionDomain)` |
39
+ | `…/security-header` | `SECURITY_HEADERS` |
40
+
41
+ ## Develop
42
+
43
+ `pnpm verify` runs formatting, lint, type-check, tests with 100% coverage and the build. Branches follow `<feature>.development` → `development` → `index`, and releases are `v<version>` tags on `index`.
44
+
45
+ ## Licence
46
+
47
+ Licença Sharadox de Código Aberto, versão 0.1.0. See [português](LICENCA.md) (the binding text) and the [English translation](LICENSE.md).
@@ -0,0 +1,10 @@
1
+ import type { DomainRedirect } from "@sharadox/next-js-configuration-web-library/domain-redirect/type";
2
+ /**
3
+ * Sends every `*.vercel.app` address (the project's alias and each deployment's own address) to the same path on
4
+ * the real domain, permanently, so the site is reachable only on its own domain.
5
+ *
6
+ * @example
7
+ * vercelAppRedirect("sharadox.com"); // [{ source: "/:path*", has: [{ type: "host", value: ".*\\.vercel\\.app" }], destination: "https://sharadox.com/:path*", permanent: true }]
8
+ */
9
+ export declare function vercelAppRedirect(productionDomain: string): DomainRedirect[];
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/domain-redirect/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAEvG;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,cAAc,EAAE,CAS5E"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Sends every `*.vercel.app` address (the project's alias and each deployment's own address) to the same path on
3
+ * the real domain, permanently, so the site is reachable only on its own domain.
4
+ *
5
+ * @example
6
+ * vercelAppRedirect("sharadox.com"); // [{ source: "/:path*", has: [{ type: "host", value: ".*\\.vercel\\.app" }], destination: "https://sharadox.com/:path*", permanent: true }]
7
+ */
8
+ export function vercelAppRedirect(productionDomain) {
9
+ return [
10
+ {
11
+ source: "/:path*",
12
+ has: [{ type: "host", value: ".*\\.vercel\\.app" }],
13
+ destination: `https://${productionDomain}/:path*`,
14
+ permanent: true,
15
+ },
16
+ ];
17
+ }
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/domain-redirect/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,gBAAwB;IACxD,OAAO;QACL;YACE,MAAM,EAAE,SAAS;YACjB,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;YACnD,WAAW,EAAE,WAAW,gBAAgB,SAAS;YACjD,SAAS,EAAE,IAAI;SAChB;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /** One Next.js redirect matched on the host. */
2
+ export interface DomainRedirect {
3
+ source: string;
4
+ has: {
5
+ type: "host";
6
+ value: string;
7
+ }[];
8
+ destination: string;
9
+ permanent: true;
10
+ }
11
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/domain-redirect/type.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/domain-redirect/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { NextConfig } from "next";
2
+ import type { NextConfigurationOptions } from "@sharadox/next-js-configuration-web-library/next-configuration/type";
3
+ /**
4
+ * The Next.js configuration of a Sharadox-style application: Sass finds `src/` and the site library's design
5
+ * helpers, `/` follows the visitor's language, every page sends security headers, and once the site has its own
6
+ * domain, `*.vercel.app` addresses redirect to it.
7
+ *
8
+ * @example
9
+ * // next.config.ts
10
+ * export default defineNextConfiguration({ root: new URL("./", import.meta.url), styleLibrary: "@sharadox/sharadox-web-library",
11
+ * locales: LOCALES, productionDomain: "sharadox.com" });
12
+ */
13
+ export declare function defineNextConfiguration<Locale extends string>({ root, styleLibrary, locales, productionDomain, next, }: NextConfigurationOptions<Locale>): NextConfig;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/next-configuration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAKvC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qEAAqE,CAAC;AAEpH;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,SAAS,MAAM,EAAE,EAC7D,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,IAAS,GACV,EAAE,wBAAwB,CAAC,MAAM,CAAC,GAAG,UAAU,CAiB/C"}
@@ -0,0 +1,33 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import { localeRedirects } from "@sharadox/internationalization-web-library/locale-redirect";
3
+ import { vercelAppRedirect } from "@sharadox/next-js-configuration-web-library/domain-redirect";
4
+ import { SECURITY_HEADERS } from "@sharadox/next-js-configuration-web-library/security-header";
5
+ /**
6
+ * The Next.js configuration of a Sharadox-style application: Sass finds `src/` and the site library's design
7
+ * helpers, `/` follows the visitor's language, every page sends security headers, and once the site has its own
8
+ * domain, `*.vercel.app` addresses redirect to it.
9
+ *
10
+ * @example
11
+ * // next.config.ts
12
+ * export default defineNextConfiguration({ root: new URL("./", import.meta.url), styleLibrary: "@sharadox/sharadox-web-library",
13
+ * locales: LOCALES, productionDomain: "sharadox.com" });
14
+ */
15
+ export function defineNextConfiguration({ root, styleLibrary, locales, productionDomain, next = {}, }) {
16
+ const path = (relative) => fileURLToPath(new URL(relative, root));
17
+ const loadPaths = [...(styleLibrary ? [path(`node_modules/${styleLibrary}/distribution`)] : []), path("src")];
18
+ return {
19
+ ...next,
20
+ sassOptions: { loadPaths, ...next.sassOptions },
21
+ async redirects() {
22
+ return [
23
+ ...(productionDomain ? vercelAppRedirect(productionDomain) : []),
24
+ ...(locales ? localeRedirects(locales) : []),
25
+ ...((await next.redirects?.()) ?? []),
26
+ ];
27
+ },
28
+ async headers() {
29
+ return [{ source: "/:path*", headers: [...SECURITY_HEADERS] }, ...((await next.headers?.()) ?? [])];
30
+ },
31
+ };
32
+ }
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/next-configuration/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,4DAA4D,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,6DAA6D,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAG/F;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CAAwB,EAC7D,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,IAAI,GAAG,EAAE,GACwB;IACjC,MAAM,IAAI,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,YAAY,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9G,OAAO;QACL,GAAG,IAAI;QACP,WAAW,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;QAC/C,KAAK,CAAC,SAAS;YACb,OAAO;gBACL,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAChE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC5C,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;aACtC,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,OAAO;YACX,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACtG,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { NextConfig } from "next";
2
+ import type { Locales } from "@sharadox/internationalization-web-library/locale/type";
3
+ export interface NextConfigurationOptions<Locale extends string> {
4
+ /** The application folder: pass `new URL("./", import.meta.url)` from next.config.ts. */
5
+ root: URL | string;
6
+ /**
7
+ * The site's library whose Sass design helpers the application `@use`s (for example
8
+ * "@sharadox/sharadox-web-library"); its `distribution/` goes on the Sass load path, after `src/`.
9
+ */
10
+ styleLibrary?: string;
11
+ /** The site's locales: `/` then redirects to the remembered, browser or default locale. */
12
+ locales?: Locales<Locale>;
13
+ /**
14
+ * The real domain once the site has one (for example "sharadox.com"): every `*.vercel.app` address then
15
+ * redirects there permanently, so the site is only reachable on its own domain.
16
+ */
17
+ productionDomain?: string;
18
+ /** Anything else for Next.js; merged over these settings. */
19
+ next?: NextConfig;
20
+ }
21
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/next-configuration/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AAEtF,MAAM,WAAW,wBAAwB,CAAC,MAAM,SAAS,MAAM;IAC7D,yFAAyF;IACzF,IAAI,EAAE,GAAG,GAAG,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6DAA6D;IAC7D,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/next-configuration/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ /** Response headers every page gets: no MIME sniffing, private referrers, no framing, no powerful features. */
2
+ export declare const SECURITY_HEADERS: readonly [{
3
+ readonly key: "X-Content-Type-Options";
4
+ readonly value: "nosniff";
5
+ }, {
6
+ readonly key: "Referrer-Policy";
7
+ readonly value: "strict-origin-when-cross-origin";
8
+ }, {
9
+ readonly key: "X-Frame-Options";
10
+ readonly value: "DENY";
11
+ }, {
12
+ readonly key: "Permissions-Policy";
13
+ readonly value: "camera=(), microphone=(), geolocation=(), payment=()";
14
+ }];
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/security-header/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAKnB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** Response headers every page gets: no MIME sniffing, private referrers, no framing, no powerful features. */
2
+ export const SECURITY_HEADERS = [
3
+ { key: "X-Content-Type-Options", value: "nosniff" },
4
+ { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
5
+ { key: "X-Frame-Options", value: "DENY" },
6
+ { key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=(), payment=()" },
7
+ ];
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/security-header/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,EAAE,GAAG,EAAE,wBAAwB,EAAE,KAAK,EAAE,SAAS,EAAE;IACnD,EAAE,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,iCAAiC,EAAE;IACpE,EAAE,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,EAAE;IACzC,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,sDAAsD,EAAE;CACpF,CAAC"}
package/llms.txt ADDED
@@ -0,0 +1,9 @@
1
+ # @sharadox/next-js-configuration-web-library
2
+
3
+ > One-call next.config for Sharadox-style apps.
4
+
5
+ - /next-configuration: defineNextConfiguration({ root: new URL("./", import.meta.url), styleLibrary?: "@sharadox/x-web-library", locales?: Locales (from @sharadox/internationalization-web-library), productionDomain?: "example.com", next?: NextConfig })
6
+ - Sass loadPaths: node_modules/<styleLibrary>/distribution, src
7
+ - redirects: *.vercel.app → https://<productionDomain>/:path* (308) when productionDomain is set; "/" → remembered/browser/default locale; then next.redirects()
8
+ - headers: X-Content-Type-Options nosniff, Referrer-Policy strict-origin-when-cross-origin, X-Frame-Options DENY, Permissions-Policy (no camera/mic/geo/payment); then next.headers()
9
+ - Licence: Sharadox Open Source Licence 0.1.0
package/package.json CHANGED
@@ -1,6 +1,85 @@
1
1
  {
2
2
  "name": "@sharadox/next-js-configuration-web-library",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "The shared Next.js configuration: Sass load paths for a site library's design helpers, locale redirects, security headers and permanent redirects from vercel.app addresses to the real domain.",
5
+ "private": false,
6
+ "license": "SEE LICENSE IN LICENCA.md",
7
+ "author": "Sharadox <contact@sharadox.com>",
8
+ "type": "module",
9
+ "exports": {
10
+ "./*/type": {
11
+ "sharadox-source": "./source/*/type.ts",
12
+ "types": "./distribution/*/type.d.ts"
13
+ },
14
+ "./*": {
15
+ "sharadox-source": [
16
+ "./source/*/index.ts",
17
+ "./source/*/index.tsx"
18
+ ],
19
+ "types": "./distribution/*/index.d.ts",
20
+ "default": "./distribution/*/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "distribution",
25
+ "LICENCA.md",
26
+ "LICENSE.md",
27
+ "NOTICE.md",
28
+ "llms.txt"
29
+ ],
30
+ "sideEffects": false,
31
+ "engines": {
32
+ "node": ">=24"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "lint-staged": {
38
+ "*.{ts,tsx,js,mjs,cjs}": [
39
+ "prettier --write",
40
+ "eslint --fix --max-warnings=0"
41
+ ],
42
+ "*.{json,md,yml,yaml,scss}": "prettier --write"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/Sharadox/next-js-configuration-web-library.git"
47
+ },
48
+ "homepage": "https://github.com/Sharadox/next-js-configuration-web-library#readme",
49
+ "devDependencies": {
50
+ "@sharadox/es-lint-configuration-web-library": "^0.1.1",
51
+ "@sharadox/prettier-configuration-web-library": "^0.1.0",
52
+ "@sharadox/turborepo-configuration-web-library": "^0.1.0",
53
+ "@sharadox/type-script-configuration-web-library": "^0.2.0",
54
+ "@sharadox/vitest-configuration-web-library": "^0.1.2",
55
+ "@types/node": "^24.19.2",
56
+ "@vitest/coverage-v8": "^5.1.0",
57
+ "eslint": "9.39.5",
58
+ "husky": "^9.1.7",
59
+ "lint-staged": "^17.6.0",
60
+ "next": "16.4.5",
61
+ "prettier": "^3.10.0",
62
+ "turbo": "^2.11.10",
63
+ "typedoc": "^0.28.20",
64
+ "typescript": "6.0.3",
65
+ "vitest": "^5.1.0"
66
+ },
67
+ "dependencies": {
68
+ "@sharadox/internationalization-web-library": "^0.1.0",
69
+ "@sharadox/web-library": "^0.5.0"
70
+ },
71
+ "peerDependencies": {
72
+ "next": ">=16"
73
+ },
74
+ "scripts": {
75
+ "build": "rm -rf distribution && tsc -p tsconfig.build.json",
76
+ "lint": "eslint --max-warnings=0 .",
77
+ "format": "prettier --write .",
78
+ "format:check": "prettier --check .",
79
+ "type-check": "tsc --noEmit",
80
+ "test:unit": "vitest run --coverage",
81
+ "documentation": "typedoc",
82
+ "verify": "turbo run format:check lint type-check test:unit build",
83
+ "test:benchmark": "vitest bench --run --passWithNoTests"
84
+ }
6
85
  }