Compare commits

..

17 Commits

Author SHA1 Message Date
866cb79aa7 1.0.38 2023-07-27 12:37:28 +02:00
5a59abd1df fix(core): update 2023-07-27 12:37:27 +02:00
b0c6fb662d 1.0.37 2023-05-01 14:42:57 +02:00
2a8c0dec5f fix(core): update 2023-05-01 14:42:57 +02:00
bb5f70a28e 1.0.36 2023-05-01 14:38:54 +02:00
e87833c59f fix(core): update 2023-05-01 14:38:53 +02:00
cc5f93305b 1.0.35 2021-08-17 23:33:47 +02:00
67052baad0 1.0.34 2021-08-17 23:18:45 +02:00
08fc62d06f fix(core): update 2021-08-17 23:18:44 +02:00
975e463fd6 1.0.33 2021-08-17 15:42:38 +02:00
3bc93871f9 fix(core): update 2021-08-17 15:42:37 +02:00
49db495bb9 1.0.32 2021-08-17 12:54:20 +02:00
d0ee536301 fix(core): update 2021-08-17 12:54:19 +02:00
344e213c41 1.0.31 2021-08-16 17:47:21 +02:00
0ae13c970e fix(core): update 2021-08-16 17:47:20 +02:00
0502e7bc99 1.0.30 2021-08-16 16:26:13 +02:00
c0a425e16d fix(core): update 2021-08-16 16:26:13 +02:00
18 changed files with 5078 additions and 29023 deletions

View File

@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -0,0 +1,124 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @gitzone/tsdoc
npmci command tsdoc
continue-on-error: true

View File

@ -12,29 +12,25 @@ stages:
- release - release
- metadata - metadata
before_script:
- pnpm install -g pnpm
- pnpm install -g @shipzone/npmci
- npmci npm prepare
# ====================
# security stage
# ====================
# ==================== # ====================
# security stage # security stage
# ==================== # ====================
mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies: auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org - npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production - npmci command pnpm audit --audit-level=high --prod
tags: tags:
- lossless
- docker - docker
allow_failure: true allow_failure: true
@ -42,11 +38,10 @@ auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org - npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev - npmci command pnpm audit --audit-level=high --dev
tags: tags:
- lossless
- docker - docker
allow_failure: true allow_failure: true
@ -57,7 +52,6 @@ auditDevDependencies:
testStable: testStable:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install stable - npmci node install stable
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
@ -68,10 +62,9 @@ testStable:
testBuild: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install stable - npmci node install stable
- npmci npm install - npmci npm install
- npmci command npm run build - npmci npm build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
@ -97,10 +90,9 @@ codequality:
only: only:
- tags - tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g typescript
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- lossless - lossless
- docker - docker
@ -120,11 +112,9 @@ trigger:
pages: pages:
stage: metadata stage: metadata
script: script:
- npmci node install lts - npmci node install stable
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command npm run buildDocs
tags: tags:
- lossless - lossless
- docker - docker

24
.vscode/launch.json vendored
View File

@ -2,28 +2,10 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "current file", "command": "npm test",
"type": "node", "name": "Run npm test",
"request": "launch", "request": "launch",
"args": [ "type": "node-terminal"
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
} }
] ]
} }

View File

@ -3,10 +3,10 @@
"projectType": "npm", "projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "push.rocks",
"gitrepo": "smartssr", "gitrepo": "smartssr",
"shortDescription": "a smart server side renderer supporting shadow dom", "description": "a smart server side renderer supporting shadow dom",
"npmPackagename": "@pushrocks/smartssr", "npmPackagename": "@push.rocks/smartssr",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks" "projectDomain": "push.rocks"
} }

28860
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartssr", "name": "@push.rocks/smartssr",
"version": "1.0.29", "version": "1.0.38",
"private": false, "private": false,
"description": "a smart server side renderer supporting shadow dom", "description": "a smart server side renderer supporting shadow dom",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -9,24 +9,24 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/ --web)", "test": "(tstest test/ --web)",
"build": "(tsbuild --web)", "build": "(tsbuild --web --allowimplicitany)",
"serve": "tsrun scripts/serve.ts" "serve": "tsrun scripts/serve.ts",
"buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.66",
"@gitzone/tstest": "^1.0.54", "@gitzone/tsrun": "^1.2.44",
"@pushrocks/smartserve": "^1.1.41", "@gitzone/tstest": "^1.0.77",
"@pushrocks/tapbundle": "^3.2.14", "@push.rocks/tapbundle": "^5.0.8",
"@types/node": "^15.3.0", "@types/node": "^20.4.5"
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.10", "@push.rocks/smartdelay": "^3.0.1",
"@pushrocks/smartfile": "^8.0.10", "@push.rocks/smartfile": "^10.0.26",
"@pushrocks/smartpromise": "^3.1.5", "@push.rocks/smartpath": "^5.0.5",
"@pushrocks/smartpuppeteer": "^1.0.21", "@push.rocks/smartpromise": "^4.0.2",
"@pushrocks/smarttime": "^3.0.38" "@push.rocks/smartpuppeteer": "^2.0.2",
"@push.rocks/smarttime": "^4.0.1"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",
@ -42,5 +42,6 @@
], ],
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
] ],
"type": "module"
} }

4744
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,26 @@
# @pushrocks/smartssr # @push.rocks/smartssr
a smart server side renderer supporting shadow dom a smart server side renderer supporting shadow dom
## Availabililty and Links ## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartssr) * [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartssr)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartssr) * [gitlab.com (source)](https://gitlab.com/push.rocks/smartssr)
* [github.com (source mirror)](https://github.com/pushrocks/smartssr) * [github.com (source mirror)](https://github.com/push.rocks/smartssr)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartssr/) * [docs (typedoc)](https://push.rocks.gitlab.io/smartssr/)
## Status for master ## Status for master
Status Category | Status Badge Status Category | Status Badge
-- | -- -- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartssr/badges/master/pipeline.svg)](https://lossless.cloud) GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartssr/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartssr/badges/master/coverage.svg)](https://lossless.cloud) GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartssr/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartssr)](https://lossless.cloud) npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartssr)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartssr)](https://lossless.cloud) Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartssr)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartssr)](https://lossless.cloud) PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartssr)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartssr)](https://lossless.cloud) PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartssr)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartssr)](https://lossless.cloud) BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartssr)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage
@ -33,7 +32,6 @@ We are always happy for code contributions. If you are not the code contributing
For further information read the linked docs at the top of this readme. For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) ## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -1,5 +1,5 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@push.rocks/tapbundle';
import * as smartssr from '../ts/index'; import * as smartssr from '../ts/index.js';
let testSSRInstance: smartssr.SmartSSR; let testSSRInstance: smartssr.SmartSSR;
@ -13,11 +13,11 @@ tap.test('should render central.eu', async (tools) => {
await testSSRInstance.renderPage('https://lossless.com'); await testSSRInstance.renderPage('https://lossless.com');
}); });
tap.skip.test('should render lossless.com', async () => { tap.test('should render lossless.com', async () => {
await testSSRInstance.renderPage('https://lossless.com'); await testSSRInstance.renderPage('https://lossless.com');
}); });
tap.skip.test('should render https://lossless.gmbh', async () => { tap.test('should render https://lossless.gmbh', async () => {
const renderedPage = await testSSRInstance.renderPage('https://lossless.gmbh'); const renderedPage = await testSSRInstance.renderPage('https://lossless.gmbh');
console.log(renderedPage); console.log(renderedPage);
}); });

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartssr',
version: '1.0.38',
description: 'a smart server side renderer supporting shadow dom'
}

View File

@ -1 +1 @@
export * from './smartssr.classes.smartssr'; export * from './smartssr.classes.smartssr.js';

View File

@ -1,7 +1,7 @@
import * as plugins from './smartssr.plugins'; import * as plugins from './smartssr.plugins.js';
import * as paths from './smartssr.paths'; import * as paths from './smartssr.paths.js';
import { serializeFunction } from './smartssr.function.serialize'; import { serializeFunction } from './smartssr.function.serialize.js';
export interface ISmartSSROptions { export interface ISmartSSROptions {
debug: boolean; debug: boolean;
@ -27,50 +27,51 @@ export class SmartSSR {
overallTimeMeasurement.start(); overallTimeMeasurement.start();
const resultDeferred = plugins.smartpromise.defer<string>(); const resultDeferred = plugins.smartpromise.defer<string>();
const browser = new plugins.smartpuppeteer.IncognitoBrowser(); const browser = new plugins.smartpuppeteer.IncognitoBrowser();
const renderTimeMeasurement = new plugins.smarttime.HrtMeasurement();
let renderedPageString: string;
let screenshotBuffer: Buffer;
await browser.start(); await browser.start();
try {
const context = await browser.getNewIncognitoContext(); const context = await browser.getNewIncognitoContext();
const page = await context.newPage(); const page = await context.newPage();
// lets protext against left open tabs // lets protect against left open tabs
plugins.smartdelay.delayFor(30000).then(() => { plugins.smartdelay.delayFor(30000).then(async () => {
if (!page.isClosed) { try {
page.close(); await browser.stop();
context.close(); } catch {}
throw new Error(`failed to render ${urlArg}`);
}
}); });
page.on('console', (msg) => { page.on('console', (msg) => {
console.log(`${urlArg}: ${msg.text()}`); console.log(`${urlArg}: ${msg.text()}`);
}); });
const renderTimeMeasurement = new plugins.smarttime.HrtMeasurement();
renderTimeMeasurement.start(); renderTimeMeasurement.start();
await page.goto(urlArg, { await page.goto(urlArg, {
waitUntil: 'networkidle2', waitUntil: 'networkidle2',
timeout: 30000, timeout: 30000,
}); });
let screenshotBuffer: Buffer;
if (this.options.debug) { if (this.options.debug) {
screenshotBuffer = await page.screenshot({ screenshotBuffer = (await page.screenshot({
encoding: 'binary', encoding: 'binary',
}); })) as Buffer;
} }
await page.$eval('body', serializeFunction); await page.$eval('body', serializeFunction);
const pageContent = await page.content(); const pageContent = await page.content();
const renderedPageString = pageContent; renderedPageString = pageContent;
resultDeferred.resolve(renderedPageString); resultDeferred.resolve(renderedPageString);
const result = await resultDeferred.promise;
renderTimeMeasurement.stop(); renderTimeMeasurement.stop();
// lets clean up async // lets clean up async
await page.close(); await page.close();
await context.close(); await context.close();
} catch (e) {
console.log(e);
await browser.stop();
return;
}
await browser.stop(); await browser.stop();
overallTimeMeasurement.stop(); overallTimeMeasurement.stop();
@ -91,6 +92,6 @@ export class SmartSSR {
fs.writeFileSync(plugins.path.join(paths.noGitDir, 'test.png'), screenshotBuffer); fs.writeFileSync(plugins.path.join(paths.noGitDir, 'test.png'), screenshotBuffer);
} }
return result; return resultDeferred.promise;
} }
} }

View File

@ -1,5 +1,5 @@
declare var document: Document; declare var document: Document;
export function serializeFunction(rootNode) { export function serializeFunction(rootNode: Node) {
const uuidv4 = () => { const uuidv4 = () => {
return 'unixxxxxxxxxxx'.replace(/[xy]/g, (c) => { return 'unixxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0; const r = (Math.random() * 16) | 0;
@ -26,7 +26,7 @@ export function serializeFunction(rootNode) {
}; };
const loopProtection: any[] = []; const loopProtection: any[] = [];
function serializeNode(nodeArg: HTMLElement, logThis = false) { function serializeNode(nodeArg: HTMLElement | any, logThis = false) {
if (loopProtection.includes(nodeArg)) { if (loopProtection.includes(nodeArg)) {
return; return;
} }
@ -45,12 +45,12 @@ export function serializeFunction(rootNode) {
// handle slot element // handle slot element
const slotsForMove: HTMLSlotElement[] = []; const slotsForMove: HTMLSlotElement[] = [];
slots.forEach((slot) => { slots.forEach((slot: any) => {
slotsForMove.push(slot); slotsForMove.push(slot);
}); });
for (const slot of slotsForMove) { for (const slot of slotsForMove) {
const slottedLightNodesForMove = []; const slottedLightNodesForMove: any[] = [];
slot.assignedNodes().forEach((lightNode) => slottedLightNodesForMove.push(lightNode)); slot.assignedNodes().forEach((lightNode) => slottedLightNodesForMove.push(lightNode));
slottedLightNodesForMove.forEach((lightNode) => slottedLightNodesForMove.forEach((lightNode) =>
slot.parentNode.insertBefore(lightNode, slot) slot.parentNode.insertBefore(lightNode, slot)
@ -63,7 +63,10 @@ export function serializeFunction(rootNode) {
const noteForAppending: HTMLElement[] = []; const noteForAppending: HTMLElement[] = [];
// lets care about static css first // lets care about static css first
if ((nodeArg.constructor as any).styles && (nodeArg.constructor as any).styles instanceof Array) { if (
(nodeArg.constructor as any).styles &&
(nodeArg.constructor as any).styles instanceof Array
) {
for (const objectArg of (nodeArg.constructor as any).styles) { for (const objectArg of (nodeArg.constructor as any).styles) {
const styleTag = document.createElement('style'); const styleTag = document.createElement('style');
styleTag.textContent = prependCss(nodeUUID, objectArg.cssText); styleTag.textContent = prependCss(nodeUUID, objectArg.cssText);
@ -71,7 +74,7 @@ export function serializeFunction(rootNode) {
} }
} }
childNodes.forEach((childNode) => { childNodes.forEach((childNode: ChildNode) => {
if (childNode instanceof HTMLElement) { if (childNode instanceof HTMLElement) {
if (childNode.tagName === 'STYLE') { if (childNode.tagName === 'STYLE') {
childNode.textContent = prependCss(nodeUUID, childNode.textContent); childNode.textContent = prependCss(nodeUUID, childNode.textContent);

View File

@ -1,5 +1,8 @@
import * as plugins from './smartssr.plugins'; import * as plugins from './smartssr.plugins.js';
export const packageDir = plugins.path.join(__dirname, '../'); export const packageDir = plugins.path.join(
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
'../'
);
export const noGitDir = plugins.path.join(packageDir, './.nogit'); export const noGitDir = plugins.path.join(packageDir, './.nogit');
plugins.smartfile.fs.ensureDirSync(noGitDir); plugins.smartfile.fs.ensureDirSync(noGitDir);

View File

@ -4,10 +4,11 @@ import * as path from 'path';
export { path }; export { path };
// @pushrocks scope // @pushrocks scope
import * as smartdelay from '@pushrocks/smartdelay'; import * as smartdelay from '@push.rocks/smartdelay';
import * as smartfile from '@pushrocks/smartfile'; import * as smartfile from '@push.rocks/smartfile';
import * as smartpuppeteer from '@pushrocks/smartpuppeteer'; import * as smartpuppeteer from '@push.rocks/smartpuppeteer';
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpath from '@push.rocks/smartpath';
import * as smarttime from '@pushrocks/smarttime'; import * as smartpromise from '@push.rocks/smartpromise';
import * as smarttime from '@push.rocks/smarttime';
export { smartdelay, smartfile, smartpuppeteer, smartpromise, smarttime }; export { smartdelay, smartfile, smartpath, smartpuppeteer, smartpromise, smarttime };

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"esModuleInterop": true,
"verbatimModuleSyntax": true,
}
}

View File

@ -1,17 +0,0 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}