@teleporthq/teleport-project-generator-html 0.23.3 → 0.23.5
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/__tests__/end2end/index.ts +1 -1
- package/__tests__/index.ts +18 -5
- package/dist/cjs/{plugin-image-resolution.d.ts → error-page-mapping.d.ts} +2 -6
- package/dist/cjs/error-page-mapping.js +78 -0
- package/dist/cjs/error-page-mapping.js.map +1 -0
- package/dist/cjs/index.d.ts +3 -2
- package/dist/cjs/index.js +10 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/plugin-clone-globals.js +96 -49
- package/dist/cjs/plugin-clone-globals.js.map +1 -1
- package/dist/{esm/plugin-image-resolution.d.ts → cjs/plugin-home-replace.d.ts} +2 -6
- package/dist/cjs/{plugin-image-resolution.js → plugin-home-replace.js} +9 -88
- package/dist/cjs/plugin-home-replace.js.map +1 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/error-page-mapping.d.ts +7 -0
- package/dist/esm/error-page-mapping.js +75 -0
- package/dist/esm/error-page-mapping.js.map +1 -0
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.js +8 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/plugin-clone-globals.js +73 -49
- package/dist/esm/plugin-clone-globals.js.map +1 -1
- package/dist/esm/plugin-home-replace.d.ts +7 -0
- package/dist/esm/{plugin-image-resolution.js → plugin-home-replace.js} +8 -84
- package/dist/esm/plugin-home-replace.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/index.ts +4 -1
- package/src/plugin-clone-globals.ts +21 -4
- package/dist/cjs/plugin-image-resolution.js.map +0 -1
- package/dist/esm/plugin-image-resolution.js.map +0 -1
|
@@ -56,7 +56,7 @@ describe('Unwinds the slot inside the component when used in page', () => {
|
|
|
56
56
|
(file) => file.name === 'index' && file.fileType === FileType.HTML
|
|
57
57
|
)
|
|
58
58
|
const cssFile = result.files.find(
|
|
59
|
-
(file) => file.name === '
|
|
59
|
+
(file) => file.name === 'index' && file.fileType === FileType.CSS
|
|
60
60
|
)
|
|
61
61
|
|
|
62
62
|
expect(indexFile).toBeDefined()
|
package/__tests__/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import ProjectTemplate from '../src/project-template'
|
|
|
3
3
|
import { htmlErrorPageMapping } from '../src/error-page-mapping'
|
|
4
4
|
import { createHTMLProjectGenerator } from '../src'
|
|
5
5
|
import fallbackUidlSample from '../../../examples/uidl-samples/project.json'
|
|
6
|
+
import subfolderUIDL from '../../../examples/uidl-samples/subfolder.json'
|
|
6
7
|
import uidlWithCompStyleOverrides from '../../../examples/test-samples/comp-style-overrides.json'
|
|
7
8
|
import uidlWithImages from '../../../examples/test-samples/html-image-use-cases.json'
|
|
8
9
|
|
|
@@ -15,7 +16,7 @@ describe('Passes the rootClass which using the component', () => {
|
|
|
15
16
|
(file) => file.name === 'index' && file.fileType === FileType.HTML
|
|
16
17
|
)
|
|
17
18
|
const styleFile = result.files.find(
|
|
18
|
-
(file) => file.name === '
|
|
19
|
+
(file) => file.name === 'index' && file.fileType === FileType.CSS
|
|
19
20
|
)
|
|
20
21
|
|
|
21
22
|
expect(mainFile).toBeDefined()
|
|
@@ -29,13 +30,13 @@ describe('Image Resolution', () => {
|
|
|
29
30
|
const generator = createHTMLProjectGenerator()
|
|
30
31
|
const { files } = await generator.generateProject(uidlWithImages)
|
|
31
32
|
|
|
32
|
-
const mainCSS = files.find((file) => file.name === '
|
|
33
|
+
const mainCSS = files.find((file) => file.name === 'index' && file.fileType === FileType.CSS)
|
|
33
34
|
const indexFile = files.find((file) => file.name === 'index' && file.fileType === FileType.HTML)
|
|
34
35
|
|
|
35
36
|
expect(indexFile).toBeDefined()
|
|
36
37
|
expect(mainCSS).toBeDefined()
|
|
37
|
-
expect(indexFile?.content).toContain(`href="public/playground_assets/kitten.png"`)
|
|
38
|
-
expect(indexFile?.content).toContain(`src="public/playground_assets/kitten.png"`)
|
|
38
|
+
expect(indexFile?.content).toContain(`href="/public/playground_assets/kitten.png"`)
|
|
39
|
+
expect(indexFile?.content).toContain(`src="/public/playground_assets/kitten.png"`)
|
|
39
40
|
expect(mainCSS?.content).toContain(`.comp-with-image-prop-comp-with-image-bg-in-css {
|
|
40
41
|
width: 100%;
|
|
41
42
|
height: 200px;
|
|
@@ -54,7 +55,7 @@ describe('Image Resolution', () => {
|
|
|
54
55
|
expect(mainCSS?.content).toContain(`.home-div {
|
|
55
56
|
width: 100%;
|
|
56
57
|
height: 200px;
|
|
57
|
-
background-image: url("public/playground_assets/kitten.png");
|
|
58
|
+
background-image: url("/public/playground_assets/kitten.png");
|
|
58
59
|
}`)
|
|
59
60
|
})
|
|
60
61
|
|
|
@@ -81,3 +82,15 @@ describe('Meta tags from globals', () => {
|
|
|
81
82
|
})
|
|
82
83
|
})
|
|
83
84
|
})
|
|
85
|
+
|
|
86
|
+
describe('Stylesheet with substructure url from headers ', () => {
|
|
87
|
+
it('are added to each page`s head', async () => {
|
|
88
|
+
const generator = createHTMLProjectGenerator()
|
|
89
|
+
const { files } = await generator.generateProject(subfolderUIDL)
|
|
90
|
+
const pages = files.filter((file) => file.fileType === 'html' && file.name !== 'index')
|
|
91
|
+
|
|
92
|
+
pages.forEach((page) => {
|
|
93
|
+
expect(page.content).toContain('<link rel="stylesheet" href="../../style.css"')
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
})
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { ProjectPlugin, ProjectPluginStructure } from '@teleporthq/teleport-types';
|
|
2
|
-
declare class
|
|
3
|
-
private relativePath;
|
|
2
|
+
declare class HTMLErrorPageMapping implements ProjectPlugin {
|
|
4
3
|
runBefore(structure: ProjectPluginStructure): Promise<ProjectPluginStructure>;
|
|
5
4
|
runAfter(structure: ProjectPluginStructure): Promise<ProjectPluginStructure>;
|
|
6
|
-
private resolvePropsAndStates;
|
|
7
|
-
private resolveFromStyles;
|
|
8
|
-
private imageResolver;
|
|
9
5
|
}
|
|
10
|
-
export declare const
|
|
6
|
+
export declare const htmlErrorPageMapping: HTMLErrorPageMapping;
|
|
11
7
|
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.htmlErrorPageMapping = void 0;
|
|
40
|
+
var teleport_types_1 = require("@teleporthq/teleport-types");
|
|
41
|
+
var HTMLErrorPageMapping = /** @class */ (function () {
|
|
42
|
+
function HTMLErrorPageMapping() {
|
|
43
|
+
}
|
|
44
|
+
HTMLErrorPageMapping.prototype.runBefore = function (structure) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
return [2 /*return*/, structure];
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
HTMLErrorPageMapping.prototype.runAfter = function (structure) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
var uidl, files, routes, fallback, folder;
|
|
55
|
+
return __generator(this, function (_c) {
|
|
56
|
+
uidl = structure.uidl, files = structure.files;
|
|
57
|
+
routes = uidl.root.stateDefinitions.route;
|
|
58
|
+
fallback = routes.values.find(function (route) { var _a; return (_a = route.pageOptions) === null || _a === void 0 ? void 0 : _a.fallback; });
|
|
59
|
+
if (!fallback) {
|
|
60
|
+
return [2 /*return*/, structure];
|
|
61
|
+
}
|
|
62
|
+
folder = files.get((_a = fallback.pageOptions) === null || _a === void 0 ? void 0 : _a.componentName) || files.get((_b = fallback.pageOptions) === null || _b === void 0 ? void 0 : _b.fileName);
|
|
63
|
+
if (!folder) {
|
|
64
|
+
return [2 /*return*/, structure];
|
|
65
|
+
}
|
|
66
|
+
folder.files.forEach(function (file) {
|
|
67
|
+
if (file.name === fallback.pageOptions.fileName && file.fileType === teleport_types_1.FileType.HTML) {
|
|
68
|
+
file.name = '404';
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return [2 /*return*/, structure];
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
return HTMLErrorPageMapping;
|
|
76
|
+
}());
|
|
77
|
+
exports.htmlErrorPageMapping = new HTMLErrorPageMapping();
|
|
78
|
+
//# sourceMappingURL=error-page-mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-page-mapping.js","sourceRoot":"","sources":["../../src/error-page-mapping.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA4F;AAE5F;IAAA;IA2BA,CAAC;IA1BO,wCAAS,GAAf,UAAgB,SAAiC;;;gBAC/C,sBAAO,SAAS,EAAA;;;KACjB;IAEK,uCAAQ,GAAd,UAAe,SAAiC;;;;;gBACtC,IAAI,GAAY,SAAS,KAArB,EAAE,KAAK,GAAK,SAAS,MAAd,CAAc;gBAC3B,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAA;gBACzC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAC,KAAK,YAAK,OAAA,MAAA,KAAK,CAAC,WAAW,0CAAE,QAAQ,CAAA,EAAA,CAAC,CAAA;gBAC3E,IAAI,CAAC,QAAQ,EAAE;oBACb,sBAAO,SAAS,EAAA;iBACjB;gBAEK,MAAM,GACV,KAAK,CAAC,GAAG,CAAC,MAAA,QAAQ,CAAC,WAAW,0CAAE,aAAa,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAA,QAAQ,CAAC,WAAW,0CAAE,QAAQ,CAAC,CAAA;gBAC7F,IAAI,CAAC,MAAM,EAAE;oBACX,sBAAO,SAAS,EAAA;iBACjB;gBAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI;oBACxB,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,WAAW,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,yBAAQ,CAAC,IAAI,EAAE;wBAClF,IAAI,CAAC,IAAI,GAAG,KAAK,CAAA;qBAClB;gBACH,CAAC,CAAC,CAAA;gBAEF,sBAAO,SAAS,EAAA;;;KACjB;IACH,2BAAC;AAAD,CAAC,AA3BD,IA2BC;AAEY,QAAA,oBAAoB,GAAG,IAAI,oBAAoB,EAAE,CAAA"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import HTMLTemplate from './project-template';
|
|
2
2
|
import { pluginCloneGlobals } from './plugin-clone-globals';
|
|
3
|
-
import {
|
|
3
|
+
import { pluginHomeReplace } from './plugin-home-replace';
|
|
4
|
+
import { htmlErrorPageMapping } from './error-page-mapping';
|
|
4
5
|
declare const createHTMLProjectGenerator: (config?: {
|
|
5
6
|
individualEntyFile: boolean;
|
|
6
7
|
}) => import("@teleporthq/teleport-project-generator").ProjectGenerator;
|
|
7
|
-
export { createHTMLProjectGenerator, HTMLTemplate, pluginCloneGlobals,
|
|
8
|
+
export { createHTMLProjectGenerator, HTMLTemplate, pluginCloneGlobals, pluginHomeReplace, htmlErrorPageMapping, };
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.htmlErrorPageMapping = exports.pluginHomeReplace = exports.pluginCloneGlobals = exports.HTMLTemplate = exports.createHTMLProjectGenerator = void 0;
|
|
7
7
|
var teleport_project_generator_1 = require("@teleporthq/teleport-project-generator");
|
|
8
8
|
var teleport_component_generator_html_1 = require("@teleporthq/teleport-component-generator-html");
|
|
9
9
|
var teleport_component_generator_1 = require("@teleporthq/teleport-component-generator");
|
|
@@ -13,8 +13,10 @@ var project_template_1 = __importDefault(require("./project-template"));
|
|
|
13
13
|
exports.HTMLTemplate = project_template_1.default;
|
|
14
14
|
var plugin_clone_globals_1 = require("./plugin-clone-globals");
|
|
15
15
|
Object.defineProperty(exports, "pluginCloneGlobals", { enumerable: true, get: function () { return plugin_clone_globals_1.pluginCloneGlobals; } });
|
|
16
|
-
var
|
|
17
|
-
Object.defineProperty(exports, "
|
|
16
|
+
var plugin_home_replace_1 = require("./plugin-home-replace");
|
|
17
|
+
Object.defineProperty(exports, "pluginHomeReplace", { enumerable: true, get: function () { return plugin_home_replace_1.pluginHomeReplace; } });
|
|
18
|
+
var error_page_mapping_1 = require("./error-page-mapping");
|
|
19
|
+
Object.defineProperty(exports, "htmlErrorPageMapping", { enumerable: true, get: function () { return error_page_mapping_1.htmlErrorPageMapping; } });
|
|
18
20
|
var createHTMLProjectGenerator = function (config) {
|
|
19
21
|
var individualEntyFile = (config || { individualEntyFile: true }).individualEntyFile;
|
|
20
22
|
var generator = (0, teleport_project_generator_1.createProjectGenerator)({
|
|
@@ -26,9 +28,12 @@ var createHTMLProjectGenerator = function (config) {
|
|
|
26
28
|
pages: {
|
|
27
29
|
generator: teleport_component_generator_html_1.createHTMLComponentGenerator,
|
|
28
30
|
path: [''],
|
|
31
|
+
options: {
|
|
32
|
+
useFileNameForNavigation: true,
|
|
33
|
+
},
|
|
29
34
|
},
|
|
30
35
|
static: {
|
|
31
|
-
prefix: '',
|
|
36
|
+
prefix: '/public',
|
|
32
37
|
path: ['public'],
|
|
33
38
|
},
|
|
34
39
|
projectStyleSheet: {
|
|
@@ -44,7 +49,7 @@ var createHTMLProjectGenerator = function (config) {
|
|
|
44
49
|
path: [''],
|
|
45
50
|
},
|
|
46
51
|
});
|
|
47
|
-
generator.addPlugin(
|
|
52
|
+
generator.addPlugin(plugin_home_replace_1.pluginHomeReplace);
|
|
48
53
|
if (individualEntyFile) {
|
|
49
54
|
generator.addPlugin(plugin_clone_globals_1.pluginCloneGlobals);
|
|
50
55
|
}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,qFAA+E;AAC/E,mGAA4F;AAC5F,yFAAmF;AACnF,uEAAwE;AACxE,0HAA2E;AAC3E,wEAA6C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,qFAA+E;AAC/E,mGAA4F;AAC5F,yFAAmF;AACnF,uEAAwE;AACxE,0HAA2E;AAC3E,wEAA6C;AAiD3C,uBAjDK,0BAAY,CAiDL;AAhDd,+DAA2D;AAiDzD,mGAjDO,yCAAkB,OAiDP;AAhDpB,6DAAyD;AAiDvD,kGAjDO,uCAAiB,OAiDP;AAhDnB,2DAA2D;AAiDzD,qGAjDO,yCAAoB,OAiDP;AA/CtB,IAAM,0BAA0B,GAAG,UAAC,MAAwC;IAClE,IAAA,kBAAkB,GAAK,CAAA,MAAM,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAA,mBAA3C,CAA2C;IAErE,IAAM,SAAS,GAAG,IAAA,mDAAsB,EAAC;QACvC,EAAE,EAAE,uBAAuB;QAC3B,UAAU,EAAE;YACV,SAAS,EAAE,gEAA4B;YACvC,IAAI,EAAE,CAAC,YAAY,CAAC;SACrB;QACD,KAAK,EAAE;YACL,SAAS,EAAE,gEAA4B;YACvC,IAAI,EAAE,CAAC,EAAE,CAAC;YACV,OAAO,EAAE;gBACP,wBAAwB,EAAE,IAAI;aAC/B;SACF;QACD,MAAM,EAAE;YACN,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,CAAC,QAAQ,CAAC;SACjB;QACD,iBAAiB,EAAE;YACjB,SAAS,EAAE,uDAAwB;YACnC,OAAO,EAAE,CAAC,IAAA,4CAAsB,GAAE,CAAC;YACnC,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE,CAAC,EAAE,CAAC;YACV,UAAU,EAAE,IAAI;SACjB;QACD,KAAK,EAAE;YACL,cAAc,EAAE,CAAC,8CAAY,CAAC;YAC9B,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE,CAAC,EAAE,CAAC;SACX;KACF,CAAC,CAAA;IAEF,SAAS,CAAC,SAAS,CAAC,uCAAiB,CAAC,CAAA;IACtC,IAAI,kBAAkB,EAAE;QACtB,SAAS,CAAC,SAAS,CAAC,yCAAkB,CAAC,CAAA;KACxC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAGC,gEAA0B"}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,8 +64,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
65
|
exports.pluginCloneGlobals = void 0;
|
|
43
66
|
var teleport_types_1 = require("@teleporthq/teleport-types");
|
|
44
|
-
var node_html_parser_1 = require("node-html-parser");
|
|
45
67
|
var teleport_postprocessor_prettier_html_1 = __importDefault(require("@teleporthq/teleport-postprocessor-prettier-html"));
|
|
68
|
+
var cheerio_1 = require("cheerio");
|
|
46
69
|
var ProjectPluginCloneGlobals = /** @class */ (function () {
|
|
47
70
|
function ProjectPluginCloneGlobals() {
|
|
48
71
|
}
|
|
@@ -56,56 +79,80 @@ var ProjectPluginCloneGlobals = /** @class */ (function () {
|
|
|
56
79
|
ProjectPluginCloneGlobals.prototype.runAfter = function (structure) {
|
|
57
80
|
var _a;
|
|
58
81
|
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
var files, uidl, entryFile,
|
|
82
|
+
var files, uidl, entryFile, parsedEntry, scriptTagsFromRootBody, metaTagsFromRoot, titleTagsFromRoot, memoryFiles, id, fileId, newFiles;
|
|
60
83
|
return __generator(this, function (_b) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
84
|
+
switch (_b.label) {
|
|
85
|
+
case 0:
|
|
86
|
+
files = structure.files, uidl = structure.uidl;
|
|
87
|
+
entryFile = (_a = files.get('entry')) === null || _a === void 0 ? void 0 : _a.files[0];
|
|
88
|
+
if (!entryFile) {
|
|
89
|
+
return [2 /*return*/, structure];
|
|
90
|
+
}
|
|
91
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('cheerio')); }).then(function (mod) { return mod.load; })];
|
|
92
|
+
case 1:
|
|
93
|
+
parsedEntry = (_b.sent())(entryFile.content);
|
|
94
|
+
scriptTagsFromRootBody = parsedEntry('body').find('script').toString();
|
|
95
|
+
metaTagsFromRoot = parsedEntry('head').find('meta').toString();
|
|
96
|
+
titleTagsFromRoot = parsedEntry('head').find('title').toString();
|
|
97
|
+
parsedEntry('head').find('script').remove();
|
|
98
|
+
parsedEntry('body').find('script').remove();
|
|
99
|
+
parsedEntry('head').find('meta').remove();
|
|
100
|
+
parsedEntry('head').find('title').remove();
|
|
101
|
+
memoryFiles = Object.fromEntries(files);
|
|
102
|
+
for (id in memoryFiles) {
|
|
103
|
+
if (memoryFiles.hasOwnProperty(id)) {
|
|
104
|
+
fileId = memoryFiles[id];
|
|
105
|
+
if (fileId.path.length === 1 && fileId.path[0] === '') {
|
|
106
|
+
newFiles = fileId.files.map(function (file) {
|
|
107
|
+
var _a;
|
|
108
|
+
var _b;
|
|
109
|
+
if (file.fileType === teleport_types_1.FileType.HTML) {
|
|
110
|
+
parsedEntry('body').empty();
|
|
111
|
+
parsedEntry('head').find('title').remove();
|
|
112
|
+
parsedEntry('head').find('meta').remove();
|
|
113
|
+
var parsedIndividualFile = (0, cheerio_1.load)(file.content);
|
|
114
|
+
var metaTags = parsedIndividualFile.root().find('meta');
|
|
115
|
+
parsedEntry('head').prepend(metaTags.toString().concat(metaTagsFromRoot));
|
|
116
|
+
metaTags.remove();
|
|
117
|
+
var titleTags = parsedIndividualFile.root().find('title');
|
|
118
|
+
parsedEntry('head').prepend(titleTags.length ? titleTags.toString() : titleTagsFromRoot);
|
|
119
|
+
titleTags.remove();
|
|
120
|
+
if (Object.values(((_b = uidl.root) === null || _b === void 0 ? void 0 : _b.styleSetDefinitions) || {}).length > 0) {
|
|
121
|
+
var prefixPath = '';
|
|
122
|
+
for (var i = 0; i < file.name.split('/').length - 1; i++) {
|
|
123
|
+
prefixPath += '../';
|
|
124
|
+
}
|
|
125
|
+
if (prefixPath === '') {
|
|
126
|
+
prefixPath = './';
|
|
127
|
+
}
|
|
128
|
+
parsedEntry('head')
|
|
129
|
+
.find('link')
|
|
130
|
+
.filter(function (_, value) {
|
|
131
|
+
return value.attribs.rel === 'stylesheet';
|
|
132
|
+
})
|
|
133
|
+
.remove();
|
|
134
|
+
parsedEntry('head').append("<link rel=\"stylesheet\" href=\"".concat(prefixPath, "style.css\"></link>"));
|
|
135
|
+
}
|
|
136
|
+
parsedEntry('body').append(parsedIndividualFile.html());
|
|
137
|
+
parsedEntry('body').append(scriptTagsFromRootBody.toString());
|
|
138
|
+
var prettyFile = (0, teleport_postprocessor_prettier_html_1.default)((_a = {},
|
|
139
|
+
_a[teleport_types_1.FileType.HTML] = parsedEntry.html(),
|
|
140
|
+
_a));
|
|
141
|
+
return {
|
|
142
|
+
name: file.name,
|
|
143
|
+
content: prettyFile[teleport_types_1.FileType.HTML],
|
|
144
|
+
fileType: teleport_types_1.FileType.HTML,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return file;
|
|
148
|
+
});
|
|
149
|
+
files.set(id, { path: fileId.path, files: newFiles });
|
|
150
|
+
}
|
|
101
151
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
});
|
|
107
|
-
files.delete('entry');
|
|
108
|
-
return [2 /*return*/, structure];
|
|
152
|
+
}
|
|
153
|
+
files.delete('entry');
|
|
154
|
+
return [2 /*return*/, structure];
|
|
155
|
+
}
|
|
109
156
|
});
|
|
110
157
|
});
|
|
111
158
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-clone-globals.js","sourceRoot":"","sources":["../../src/plugin-clone-globals.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-clone-globals.js","sourceRoot":"","sources":["../../src/plugin-clone-globals.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAKmC;AACnC,0HAA2E;AAC3E,mCAA8B;AAE9B;IAAA;IA0FA,CAAC;IAzFO,6CAAS,GAAf,UAAgB,SAAiC;;;gBAC/C,sBAAO,SAAS,EAAA;;;KACjB;IAEK,4CAAQ,GAAd,UAAe,SAAiC;;;;;;;wBACtC,KAAK,GAAW,SAAS,MAApB,EAAE,IAAI,GAAK,SAAS,KAAd,CAAc;wBAC3B,SAAS,GAAG,MAAA,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,0CAAE,KAAK,CAAC,CAAC,CAAC,CAAA;wBAC9C,IAAI,CAAC,SAAS,EAAE;4BACd,sBAAO,SAAS,EAAA;yBACjB;wBAEoB,q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AE,CAAC,CAAA"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { ProjectPlugin, ProjectPluginStructure } from '@teleporthq/teleport-types';
|
|
2
|
-
declare class
|
|
3
|
-
private relativePath;
|
|
2
|
+
declare class ProjectPluginHomeReplace implements ProjectPlugin {
|
|
4
3
|
runBefore(structure: ProjectPluginStructure): Promise<ProjectPluginStructure>;
|
|
5
4
|
runAfter(structure: ProjectPluginStructure): Promise<ProjectPluginStructure>;
|
|
6
|
-
private resolvePropsAndStates;
|
|
7
|
-
private resolveFromStyles;
|
|
8
|
-
private imageResolver;
|
|
9
5
|
}
|
|
10
|
-
export declare const
|
|
6
|
+
export declare const pluginHomeReplace: ProjectPluginHomeReplace;
|
|
11
7
|
export {};
|
|
@@ -55,100 +55,21 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
55
55
|
}
|
|
56
56
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
57
|
};
|
|
58
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
-
};
|
|
61
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
exports.
|
|
59
|
+
exports.pluginHomeReplace = void 0;
|
|
63
60
|
var teleport_shared_1 = require("@teleporthq/teleport-shared");
|
|
64
|
-
var path_browserify_1 = __importDefault(require("path-browserify"));
|
|
65
61
|
var teleport_types_1 = require("@teleporthq/teleport-types");
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
function ProjectPluginImageResolver() {
|
|
69
|
-
var _this = this;
|
|
70
|
-
this.resolvePropsAndStates = function (defs) {
|
|
71
|
-
Object.keys(defs || {}).forEach(function (propKey) {
|
|
72
|
-
var propValue = defs[propKey];
|
|
73
|
-
if (propValue.type === 'string' &&
|
|
74
|
-
typeof (propValue === null || propValue === void 0 ? void 0 : propValue.defaultValue) === 'string' &&
|
|
75
|
-
parse(propValue === null || propValue === void 0 ? void 0 : propValue.defaultValue).dir.startsWith('/')) {
|
|
76
|
-
defs[propKey] = __assign(__assign({}, defs[propKey]), { defaultValue: join(_this.relativePath, propValue.defaultValue) });
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
this.resolveFromStyles = function (style) {
|
|
81
|
-
var _a, _b;
|
|
82
|
-
if (((_a = style === null || style === void 0 ? void 0 : style.backgroundImage) === null || _a === void 0 ? void 0 : _a.type) === 'static' &&
|
|
83
|
-
typeof ((_b = style === null || style === void 0 ? void 0 : style.backgroundImage) === null || _b === void 0 ? void 0 : _b.content) === 'string') {
|
|
84
|
-
var bgImage = style.backgroundImage.content;
|
|
85
|
-
if (bgImage.includes('http')) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
var regex = /(?:\(['"]?)(.*?)(?:['"]?\))/;
|
|
89
|
-
var matches = regex.exec(bgImage);
|
|
90
|
-
if (matches && (matches === null || matches === void 0 ? void 0 : matches.length) > 0 && isAbsolute(matches[1])) {
|
|
91
|
-
style.backgroundImage.content = "url(\"".concat(join(_this.relativePath, matches[1]), "\")");
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
this.imageResolver = function (element) {
|
|
96
|
-
var _a, _b;
|
|
97
|
-
_this.resolveFromStyles((element === null || element === void 0 ? void 0 : element.style) || {});
|
|
98
|
-
Object.values((element === null || element === void 0 ? void 0 : element.referencedStyles) || {}).forEach(function (styleRef) {
|
|
99
|
-
if (styleRef.content.mapType === 'inlined') {
|
|
100
|
-
_this.resolveFromStyles(styleRef.content.styles);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
if ((element === null || element === void 0 ? void 0 : element.elementType) === 'image' &&
|
|
104
|
-
((_b = (_a = element.attrs) === null || _a === void 0 ? void 0 : _a.src) === null || _b === void 0 ? void 0 : _b.type) === 'static' &&
|
|
105
|
-
typeof element.attrs.src.content === 'string' &&
|
|
106
|
-
isAbsolute(element.attrs.src.content) &&
|
|
107
|
-
!element.attrs.src.content.startsWith('http')) {
|
|
108
|
-
element.attrs.src.content = join(_this.relativePath, element.attrs.src.content);
|
|
109
|
-
}
|
|
110
|
-
if (element.elementType === 'component') {
|
|
111
|
-
Object.keys((element === null || element === void 0 ? void 0 : element.attrs) || {}).forEach(function (attrKey) {
|
|
112
|
-
var attrValue = element === null || element === void 0 ? void 0 : element.attrs[attrKey];
|
|
113
|
-
if (attrValue.type === 'static' &&
|
|
114
|
-
typeof attrValue.content === 'string' &&
|
|
115
|
-
!attrValue.content.startsWith('http')) {
|
|
116
|
-
var resolvedPath = parse(attrValue.content);
|
|
117
|
-
if (resolvedPath.dir.startsWith('/')) {
|
|
118
|
-
element.attrs[attrKey].content = join(_this.relativePath, attrValue.content);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
};
|
|
62
|
+
var ProjectPluginHomeReplace = /** @class */ (function () {
|
|
63
|
+
function ProjectPluginHomeReplace() {
|
|
124
64
|
}
|
|
125
|
-
|
|
126
|
-
var _a;
|
|
65
|
+
ProjectPluginHomeReplace.prototype.runBefore = function (structure) {
|
|
127
66
|
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
-
|
|
129
|
-
var _this = this;
|
|
130
|
-
return __generator(this, function (_b) {
|
|
131
|
-
uidl = structure.uidl, strategy = structure.strategy;
|
|
132
|
-
assetsPath = join(strategy.id, strategy.static.path.join('/'));
|
|
133
|
-
pagesPath = join(strategy.id, strategy.pages.path.join('/'));
|
|
134
|
-
this.relativePath = relative(pagesPath, assetsPath);
|
|
135
|
-
teleport_shared_1.UIDLUtils.traverseElements(uidl.root.node, this.imageResolver);
|
|
136
|
-
Object.values(((_a = uidl === null || uidl === void 0 ? void 0 : uidl.root) === null || _a === void 0 ? void 0 : _a.styleSetDefinitions) || {}).forEach(function (styleSet) {
|
|
137
|
-
_this.resolveFromStyles(styleSet.content);
|
|
138
|
-
});
|
|
139
|
-
Object.values(uidl.components || {}).forEach(function (component) {
|
|
140
|
-
teleport_shared_1.UIDLUtils.traverseElements(component.node, _this.imageResolver);
|
|
141
|
-
Object.values((component === null || component === void 0 ? void 0 : component.styleSetDefinitions) || {}).forEach(function (styleSet) {
|
|
142
|
-
_this.resolveFromStyles(styleSet.content);
|
|
143
|
-
});
|
|
144
|
-
_this.resolvePropsAndStates(component.stateDefinitions);
|
|
145
|
-
_this.resolvePropsAndStates(component.propDefinitions);
|
|
146
|
-
});
|
|
67
|
+
return __generator(this, function (_a) {
|
|
147
68
|
return [2 /*return*/, structure];
|
|
148
69
|
});
|
|
149
70
|
});
|
|
150
71
|
};
|
|
151
|
-
|
|
72
|
+
ProjectPluginHomeReplace.prototype.runAfter = function (structure) {
|
|
152
73
|
return __awaiter(this, void 0, void 0, function () {
|
|
153
74
|
var uidl, files, stateDefinitions, defaultValue_1, routes, defaultRoute, sanitizedName, pageName_1, component, homeFile, htmlFile;
|
|
154
75
|
return __generator(this, function (_a) {
|
|
@@ -193,7 +114,7 @@ var ProjectPluginImageResolver = /** @class */ (function () {
|
|
|
193
114
|
});
|
|
194
115
|
});
|
|
195
116
|
};
|
|
196
|
-
return
|
|
117
|
+
return ProjectPluginHomeReplace;
|
|
197
118
|
}());
|
|
198
|
-
exports.
|
|
199
|
-
//# sourceMappingURL=plugin-
|
|
119
|
+
exports.pluginHomeReplace = new ProjectPluginHomeReplace();
|
|
120
|
+
//# sourceMappingURL=plugin-home-replace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-home-replace.js","sourceRoot":"","sources":["../../src/plugin-home-replace.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAoE;AACpE,6DAKmC;AAEnC;IAAA;IAuDA,CAAC;IAtDO,4CAAS,GAAf,UAAgB,SAAiC;;;gBAC/C,sBAAO,SAAS,EAAA;;;KACjB;IAEK,2CAAQ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