@tywalk/pcf-helper 1.5.3 → 1.5.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/dist/package.json +1 -1
- package/dist/tasks/session-pcf.js +6 -8
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -18,7 +18,6 @@ const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
|
|
|
18
18
|
const path_1 = __importDefault(require("path"));
|
|
19
19
|
const fs_1 = __importDefault(require("fs"));
|
|
20
20
|
const playwright_1 = require("playwright");
|
|
21
|
-
color_logger_1.default.setLevel('debug'); // Set to 'debug' for detailed logging
|
|
22
21
|
function loadConfig(config) {
|
|
23
22
|
// Load file config if exists
|
|
24
23
|
let fileConfig = {};
|
|
@@ -72,10 +71,10 @@ function loadConfig(config) {
|
|
|
72
71
|
remoteStylesheetToIntercept: remoteStylesheetToIntercept,
|
|
73
72
|
localCssPath: process.env.LOCAL_CSS_PATH ||
|
|
74
73
|
fileConfig.localCssPath ||
|
|
75
|
-
path_1.default.join(
|
|
74
|
+
path_1.default.join(process.cwd(), 'dist', 'local-control-styles.css'),
|
|
76
75
|
localBundlePath: process.env.LOCAL_BUNDLE_PATH ||
|
|
77
76
|
fileConfig.localBundlePath ||
|
|
78
|
-
path_1.default.join(
|
|
77
|
+
path_1.default.join(process.cwd(), 'dist', 'local-control-bundle.js')
|
|
79
78
|
};
|
|
80
79
|
}
|
|
81
80
|
function runSession(remoteEnvironmentUrl, remoteScriptToIntercept, remoteStylesheetToIntercept, localBundlePath, localCssPath) {
|
|
@@ -97,7 +96,7 @@ function runSession(remoteEnvironmentUrl, remoteScriptToIntercept, remoteStylesh
|
|
|
97
96
|
color_logger_1.default.debug(` Local CSS path: ${LOCAL_CSS_PATH}`);
|
|
98
97
|
color_logger_1.default.debug('');
|
|
99
98
|
// Path to store your session cookies
|
|
100
|
-
const AUTH_DIR = path_1.default.join(
|
|
99
|
+
const AUTH_DIR = path_1.default.join(process.cwd(), '.auth');
|
|
101
100
|
const STATE_FILE = path_1.default.join(AUTH_DIR, 'state.json');
|
|
102
101
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
103
102
|
color_logger_1.default.log('🚀 Starting ephemeral browser session...');
|
|
@@ -111,9 +110,8 @@ function runSession(remoteEnvironmentUrl, remoteScriptToIntercept, remoteStylesh
|
|
|
111
110
|
color_logger_1.default.log('⚠️ No previous session found. You may need to log in.');
|
|
112
111
|
}
|
|
113
112
|
// 2. Launch browser and apply context
|
|
114
|
-
const browser = yield playwright_1.chromium.launch({ headless: false });
|
|
115
|
-
const context = yield browser.newContext(Object.assign(Object.assign({}, contextOptions), { viewport: null
|
|
116
|
-
}));
|
|
113
|
+
const browser = yield playwright_1.chromium.launch({ headless: false, args: ['--auto-open-devtools-for-tabs'] });
|
|
114
|
+
const context = yield browser.newContext(Object.assign(Object.assign({}, contextOptions), { viewport: null, serviceWorkers: 'block' }));
|
|
117
115
|
// Shared cleanup function to save state and close browser
|
|
118
116
|
const cleanup = (...args_1) => __awaiter(this, [...args_1], void 0, function* (reason = 'unknown') {
|
|
119
117
|
try {
|
|
@@ -133,7 +131,7 @@ function runSession(remoteEnvironmentUrl, remoteScriptToIntercept, remoteStylesh
|
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
133
|
catch (error) {
|
|
136
|
-
color_logger_1.default.
|
|
134
|
+
color_logger_1.default.debug('Error during cleanup:', error);
|
|
137
135
|
}
|
|
138
136
|
});
|
|
139
137
|
// Handle process exit signals
|