@mayson-org/inject-script 1.0.3 → 1.0.4
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 +3 -2
- package/dist/cli.js +5 -5
- package/dist/core/generators.d.ts.map +1 -1
- package/dist/core/generators.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/plugins/ascii/index.d.ts +1 -0
- package/dist/plugins/ascii/index.d.ts.map +1 -1
- package/dist/plugins/ascii/index.js +3 -21
- package/dist/shared/ascii-art.d.ts +10 -0
- package/dist/shared/ascii-art.d.ts.map +1 -0
- package/dist/shared/ascii-art.js +44 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ Defaults when the API is not called or fails for other reasons: `showRemixPill=f
|
|
|
62
62
|
```ts
|
|
63
63
|
import { runAutoInject } from '@mayson-org/inject-script';
|
|
64
64
|
|
|
65
|
-
const result = await runAutoInject(process.cwd()
|
|
65
|
+
const result = await runAutoInject(process.cwd()); // watermark + ascii by default
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
## Package layout
|
|
@@ -78,6 +78,7 @@ src/
|
|
|
78
78
|
|
|
79
79
|
## Notes
|
|
80
80
|
|
|
81
|
-
- Default
|
|
81
|
+
- Default inject is **watermark + ascii** (override with `--type`).
|
|
82
|
+
- Watermark is still gated by `show_remix_pill`; ascii always injects when selected.
|
|
82
83
|
- Idempotent: skips components already present in the layout.
|
|
83
84
|
- Does not patch `.next` HTML; source inject only.
|
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ Usage:
|
|
|
11
11
|
|
|
12
12
|
Options:
|
|
13
13
|
--dir <path> Target project root (default: cwd)
|
|
14
|
-
--type <type> watermark | ascii | metadata | all (default: watermark)
|
|
14
|
+
--type <type> watermark | ascii | metadata | all (default: watermark + ascii)
|
|
15
15
|
--dry-run Preview without writing files
|
|
16
16
|
--help, -h Show help
|
|
17
17
|
|
|
@@ -24,7 +24,7 @@ Watermark gating (inject-time):
|
|
|
24
24
|
function parseArgs(argv) {
|
|
25
25
|
const options = {
|
|
26
26
|
projectRoot: process.cwd(),
|
|
27
|
-
|
|
27
|
+
types: ['watermark', 'ascii'],
|
|
28
28
|
dryRun: false,
|
|
29
29
|
help: false,
|
|
30
30
|
};
|
|
@@ -37,10 +37,10 @@ function parseArgs(argv) {
|
|
|
37
37
|
options.dryRun = true;
|
|
38
38
|
}
|
|
39
39
|
else if (arg.startsWith('--type=')) {
|
|
40
|
-
options.
|
|
40
|
+
options.types = [arg.split('=')[1]];
|
|
41
41
|
}
|
|
42
42
|
else if (arg === '--type' && argv[i + 1]) {
|
|
43
|
-
options.
|
|
43
|
+
options.types = [argv[++i]];
|
|
44
44
|
}
|
|
45
45
|
else if (arg.startsWith('--dir=')) {
|
|
46
46
|
options.projectRoot = path.resolve(arg.split('=')[1]);
|
|
@@ -62,7 +62,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
console.log(`Searching for Next.js root layout in: ${options.projectRoot}`);
|
|
65
|
-
const result = await runAutoInject(options.projectRoot,
|
|
65
|
+
const result = await runAutoInject(options.projectRoot, options.types, options.dryRun);
|
|
66
66
|
if (!result.success) {
|
|
67
67
|
console.error(`Error: ${result.error}`);
|
|
68
68
|
process.exitCode = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../src/core/generators.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yBAAyB,EACzB,aAAa,EACb,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,yBAAyB,EACzB,aAAa,EACb,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAQpB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../src/core/generators.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yBAAyB,EACzB,aAAa,EACb,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,yBAAyB,EACzB,aAAa,EACb,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAQpB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EAAE,YAAyB,EAC/C,OAAO,EAAE,yBAAyB,GACjC,sBAAsB,EAAE,CAkC1B"}
|
package/dist/core/generators.js
CHANGED
|
@@ -6,7 +6,7 @@ const ALL_TYPES = [
|
|
|
6
6
|
'ascii',
|
|
7
7
|
'metadata',
|
|
8
8
|
];
|
|
9
|
-
export function generateComponents(types = ['watermark'], options) {
|
|
9
|
+
export function generateComponents(types = ['watermark', 'ascii'], options) {
|
|
10
10
|
const { outputDir, isTypeScript = true, dryRun = false } = options;
|
|
11
11
|
const ext = isTypeScript ? '.tsx' : '.jsx';
|
|
12
12
|
const results = [];
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export { loadMaysonEnvConfig } from './shared/config.js';
|
|
|
8
8
|
export type { MaysonEnvConfig } from './shared/config.js';
|
|
9
9
|
export { fetchGeneratedAppMetadata, resolveMaysonConfig, shouldFetchGeneratedAppMetadata, } from './shared/generated-app-metadata.js';
|
|
10
10
|
export { watermarkPlugin, buildMaysonWatermarkSource, } from './plugins/watermark/index.js';
|
|
11
|
+
export { asciiPlugin, buildMaysonAsciiSource, } from './plugins/ascii/index.js';
|
|
12
|
+
export { BUILD_WITH_LOVE_ASCII, MAYSON_LETTER_ASCII, } from './shared/ascii-art.js';
|
|
11
13
|
export type { ComponentType, GeneratedComponentInfo, ComponentGeneratorOptions, InjectorOptions, InjectorResult, MaysonPlugin, PluginGenerateContext, } from './core/types.js';
|
|
12
14
|
/**
|
|
13
15
|
* Auto-detect root layout, fetch watermark flags from generated-app-metadata when
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EAEf,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChF,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAwBzB;;;GAGG;AACH,wBAAsB,aAAa,CACjC,WAAW,GAAE,MAAsB,EACnC,KAAK,GAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EAEf,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChF,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,WAAW,EACX,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAwBzB;;;GAGG;AACH,wBAAsB,aAAa,CACjC,WAAW,GAAE,MAAsB,EACnC,KAAK,GAAE,aAAa,EAA2B,EAC/C,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,cAAc,CAAC,CA0DzB"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,8 @@ export { buildRemixRedirectUrl, BADGE_UTM_SOURCE } from './shared/remix-url.js';
|
|
|
10
10
|
export { loadMaysonEnvConfig } from './shared/config.js';
|
|
11
11
|
export { fetchGeneratedAppMetadata, resolveMaysonConfig, shouldFetchGeneratedAppMetadata, } from './shared/generated-app-metadata.js';
|
|
12
12
|
export { watermarkPlugin, buildMaysonWatermarkSource, } from './plugins/watermark/index.js';
|
|
13
|
+
export { asciiPlugin, buildMaysonAsciiSource, } from './plugins/ascii/index.js';
|
|
14
|
+
export { BUILD_WITH_LOVE_ASCII, MAYSON_LETTER_ASCII, } from './shared/ascii-art.js';
|
|
13
15
|
function filterTypesForConfig(types, showRemixPill) {
|
|
14
16
|
const messages = [];
|
|
15
17
|
const selected = types.includes('all')
|
|
@@ -28,7 +30,7 @@ function filterTypesForConfig(types, showRemixPill) {
|
|
|
28
30
|
* Auto-detect root layout, fetch watermark flags from generated-app-metadata when
|
|
29
31
|
* configured, generate component files, and inject them.
|
|
30
32
|
*/
|
|
31
|
-
export async function runAutoInject(projectRoot = process.cwd(), types = ['watermark'], dryRun = false) {
|
|
33
|
+
export async function runAutoInject(projectRoot = process.cwd(), types = ['watermark', 'ascii'], dryRun = false) {
|
|
32
34
|
const layoutPath = findRootLayout(projectRoot);
|
|
33
35
|
if (!layoutPath) {
|
|
34
36
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/ascii/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/ascii/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,eAAO,MAAM,WAAW,EAAE,YAIzB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { useEffect } from 'react';
|
|
3
|
-
|
|
4
|
-
const ASCII_ART = \`
|
|
5
|
-
███╗ ███╗█████╗ ██╗ ██╗███████╗██████╗ ██████╗
|
|
6
|
-
████╗ ████║██╔══██╗╚██╗ ██╔╝██╔════╝██╔═══██╗██╔══██╗
|
|
7
|
-
██╔████╔██║███████║ ╚████╔╝ ███████╗██║ ██║██║ ██║
|
|
8
|
-
██║╚██╔╝██║██╔══██║ ╚██╔╝ ╚════██║██║ ██║██║ ██║
|
|
9
|
-
██║ ╚═╝ ██║██║ ██║ ██║ ███████║╚██████╔╝██████╔╝
|
|
10
|
-
\`;
|
|
11
|
-
|
|
12
|
-
export function MaysonAscii() {
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
console.log('%c' + ASCII_ART, 'color: #6366f1; font-weight: bold;');
|
|
15
|
-
console.log('%c🚀 Powered by Mayson Platform', 'color: #10b981; font-weight: bold; font-size: 12px;');
|
|
16
|
-
}, []);
|
|
17
|
-
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
1
|
+
import { buildMaysonAsciiSource } from '../../shared/ascii-art.js';
|
|
21
2
|
export const asciiPlugin = {
|
|
22
3
|
type: 'ascii',
|
|
23
4
|
name: 'MaysonAscii',
|
|
24
|
-
generateSource: () =>
|
|
5
|
+
generateSource: () => buildMaysonAsciiSource(),
|
|
25
6
|
};
|
|
7
|
+
export { buildMaysonAsciiSource } from '../../shared/ascii-art.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Console love line from the legacy next-build-plugins package. */
|
|
2
|
+
export declare const BUILD_WITH_LOVE_ASCII = "Built with \uD83D\uDC9C";
|
|
3
|
+
/** Banner letter ASCII — "MAYSON". */
|
|
4
|
+
export declare const MAYSON_LETTER_ASCII: string;
|
|
5
|
+
/**
|
|
6
|
+
* Source for the consumer-app MaysonAscii client component.
|
|
7
|
+
* Matches the legacy console script: "Built with 💜" + MAYSON letter ASCII.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildMaysonAsciiSource(): string;
|
|
10
|
+
//# sourceMappingURL=ascii-art.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ascii-art.d.ts","sourceRoot":"","sources":["../../src/shared/ascii-art.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,4BAAkB,CAAC;AAErD,sCAAsC;AACtC,eAAO,MAAM,mBAAmB,QAQpB,CAAC;AAab;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAkB/C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Console love line from the legacy next-build-plugins package. */
|
|
2
|
+
export const BUILD_WITH_LOVE_ASCII = 'Built with 💜';
|
|
3
|
+
/** Banner letter ASCII — "MAYSON". */
|
|
4
|
+
export const MAYSON_LETTER_ASCII = [
|
|
5
|
+
'░███ ░███ ░███ ░██ ░██ ░██████ ░██████ ░███ ░██',
|
|
6
|
+
'░████ ░████ ░██░██ ░██ ░██ ░██ ░██ ░██ ░██ ░████ ░██',
|
|
7
|
+
'░██░██ ░██░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██',
|
|
8
|
+
'░██ ░████ ░██ ░█████████ ░████ ░████████ ░██ ░██ ░██ ░██ ░██',
|
|
9
|
+
'░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██',
|
|
10
|
+
'░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░████',
|
|
11
|
+
'░██ ░██ ░██ ░██ ░██ ░██████ ░██████ ░██ ░███',
|
|
12
|
+
].join('\n');
|
|
13
|
+
const LOVE_STYLE = 'color:#A39FF9;font-family:monospace';
|
|
14
|
+
const ASCII_STYLE = [
|
|
15
|
+
'font-family:monospace',
|
|
16
|
+
'background:linear-gradient(90deg,#dbd0f8 0%,#a39ff9 16.24%,#8030f8 29.79%,#ae63ff 45.09%,#a828e8 59.87%,#a39ff9 79.85%,#450aa3 99.46%)',
|
|
17
|
+
'-webkit-background-clip:text',
|
|
18
|
+
'background-clip:text',
|
|
19
|
+
'color:transparent',
|
|
20
|
+
'-webkit-text-fill-color:transparent',
|
|
21
|
+
].join(';');
|
|
22
|
+
/**
|
|
23
|
+
* Source for the consumer-app MaysonAscii client component.
|
|
24
|
+
* Matches the legacy console script: "Built with 💜" + MAYSON letter ASCII.
|
|
25
|
+
*/
|
|
26
|
+
export function buildMaysonAsciiSource() {
|
|
27
|
+
return `'use client';
|
|
28
|
+
|
|
29
|
+
import React, { useEffect } from 'react';
|
|
30
|
+
|
|
31
|
+
const BUILD_WITH_LOVE = ${JSON.stringify(BUILD_WITH_LOVE_ASCII)};
|
|
32
|
+
const MAYSON_LETTER_ASCII = ${JSON.stringify(`\n${MAYSON_LETTER_ASCII}`)};
|
|
33
|
+
const LOVE_STYLE = ${JSON.stringify(LOVE_STYLE)};
|
|
34
|
+
const ASCII_STYLE = ${JSON.stringify(ASCII_STYLE)};
|
|
35
|
+
|
|
36
|
+
export function MaysonAscii() {
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
console.log('%c' + BUILD_WITH_LOVE + '%c' + MAYSON_LETTER_ASCII, LOVE_STYLE, ASCII_STYLE);
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mayson-org/inject-script",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "CLI and library to locate Next.js App Router root layouts, generate Mayson plugin components, and inject them into the layout tree.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|