fix(build): modernize package configuration and remove smartfile dependency from filesystem operations
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartssr',
|
||||
version: '1.0.40',
|
||||
version: '1.0.41',
|
||||
description: 'A smart server-side renderer that supports shadow DOM.'
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export class SmartSSR {
|
||||
const browser = new plugins.smartpuppeteer.IncognitoBrowser();
|
||||
const renderTimeMeasurement = new plugins.smarttime.HrtMeasurement();
|
||||
let renderedPageString: string;
|
||||
let screenshotBuffer: Buffer;
|
||||
let screenshotBuffer: Buffer | undefined;
|
||||
await browser.start();
|
||||
try {
|
||||
const context = await browser.getNewIncognitoContext();
|
||||
@@ -84,12 +84,11 @@ export class SmartSSR {
|
||||
|
||||
// debug
|
||||
if (this.options.debug) {
|
||||
plugins.smartfile.memory.toFsSync(
|
||||
renderedPageString,
|
||||
plugins.path.join(paths.noGitDir, 'test.html')
|
||||
);
|
||||
const fs = await import('fs');
|
||||
fs.writeFileSync(plugins.path.join(paths.noGitDir, 'test.png'), screenshotBuffer);
|
||||
fs.writeFileSync(plugins.path.join(paths.noGitDir, 'test.html'), renderedPageString);
|
||||
if (screenshotBuffer) {
|
||||
fs.writeFileSync(plugins.path.join(paths.noGitDir, 'test.png'), screenshotBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
return resultDeferred.promise;
|
||||
|
||||
@@ -5,4 +5,4 @@ export const packageDir = plugins.path.join(
|
||||
'../'
|
||||
);
|
||||
export const noGitDir = plugins.path.join(packageDir, './.nogit');
|
||||
plugins.smartfile.fs.ensureDirSync(noGitDir);
|
||||
plugins.fs.mkdirSync(noGitDir, { recursive: true });
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// node native
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
export { path };
|
||||
export { fs, path };
|
||||
|
||||
// @pushrocks scope
|
||||
import * as smartdelay from '@push.rocks/smartdelay';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartpuppeteer from '@push.rocks/smartpuppeteer';
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as smarttime from '@push.rocks/smarttime';
|
||||
|
||||
export { smartdelay, smartfile, smartpath, smartpuppeteer, smartpromise, smarttime };
|
||||
export { smartdelay, smartpath, smartpuppeteer, smartpromise, smarttime };
|
||||
|
||||
Reference in New Issue
Block a user