Repository: micahblu/gulp-connect-php
Branch: master
Commit: 4e72a68cdc2f
Files: 26
Total size: 42.0 KB
Directory structure:
gitextract_mx95pi9m/
├── .babelrc
├── .editorconfig
├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── convert.sh
├── examples/
│ ├── browser-sync/
│ │ ├── gulpfile.js
│ │ ├── index.php
│ │ └── package.json
│ ├── browser-sync-02/
│ │ ├── gulpfile.js
│ │ ├── index.php
│ │ ├── link.php
│ │ └── package.json
│ ├── simple/
│ │ ├── gulpfile.js
│ │ └── index.php
│ └── simple-with-argument-manipulation/
│ ├── gulpfile.js
│ └── index.php
├── formatting.idea.xml
├── index-compat.js
├── index.js
├── package.json
└── test/
├── fixtures/
│ ├── config-cb-checker.php
│ ├── hello.php
│ └── index.php
└── test.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"presets": [
"es2017",
"es2016",
"es2015"
]
}
================================================
FILE: .editorconfig
================================================
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
[*.md]
trim_trailing_whitespace = false
================================================
FILE: .gitignore
================================================
node_modules/
.idea
*.tgz
================================================
FILE: .npmignore
================================================
node_modules/
.idea
.gitignore
*.sh
*.xml
.babelrc
.editorconfig
*.tgz
*.txz
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2014 Micah Blu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# gulp-connect-php
***REQUIRES NODE 4 OR GREATER***
> Start a [PHP-server](http://php.net/manual/en/features.commandline.webserver.php)
This is pretty much a gulp version of [@sindresorhus's](https://github.com/sindresorhus) [grunt-php](https://github.com/sindresorhus/grunt-php) and acts as a _basic version_ drop-in replacement for [gulp-connect](https://www.npmjs.com/package/gulp-connect), though please note not all features from gulp-connect are supported with gulp-connect-php. I am open to supporting other features and pull requests that implement them.
Uses the built-in server in PHP 5.4.0+.
## Install
```sh
$ npm install --save-dev gulp-connect-php
```
## Usage
### As a Singleton
```js
var gulp = require('gulp'),
connect = require('gulp-connect-php');
gulp.task('connect', function() {
connect.server();
});
gulp.task('default', ['connect']);
```
### As an Instance
```js
var gulp = require('gulp'),
connect = require('gulp-connect-php');
let server = new connect();
gulp.task('connect', function() {
server.server();
});
gulp.task('disconnect', function() {
server.closeServer();
});
gulp.task('default', ['connect', 'disconnect']);
```
## Examples
### Use it with Browser Sync
```js
var gulp = require('gulp'),
connect = require('gulp-connect-php'),
browserSync = require('browser-sync');
gulp.task('connect-sync', function() {
connect.server({}, function (){
browserSync({
proxy: '127.0.0.1:8000'
});
});
gulp.watch('**/*.php').on('change', function () {
browserSync.reload();
});
});
```
### Advanced Option Manipulation
```js
gulp.task('connect', function() {
connect.server({
configCallback: function _configCallback(type, collection) {
// If you wish to leave one of the argument types alone, simply return the passed in collection.
if (type === connect.OPTIONS_SPAWN_OBJ) { // As the constant suggests, collection is an Object.
// Lets add a custom env var. Good for injecting AWS_RDS config variables.
collection.env = Object.assign({
MY_CUSTOM_ENV_VAR: "env_var_value"
}, process.env);
return collection;
} else if (type === connect.OPTIONS_PHP_CLI_ARR) { // As the constant suggests, collection is an Array.
let newArgs = [
'-e', // Generate extended information for debugger/profiler.
'-d', 'memory_limit=2G' // Define INI entry, Up memory limit to 2G.
];
// Ensure our argument switches appear before the rest.
return newArgs.concat(collection);
}
}
}, function _connected_callback() {
console.log("PHP Development Server Connected.");
});
});
gulp.task('disconnect', function() {
connect.closeServer();
});
gulp.task('default', ['connect', 'disconnect']);
```
### Windows (via Batch file)
Windows Batch file execution via a `%PATH%` specified batchfile is possible, but some considerations are required.
1. The batch file must be on your `%PATH%` and executable with permissions of the invoker.
2. You must pass the parameter set off to the PHP process.
3. We have no -real- way of detecting an error state at this point.
4. You must use the 'Advanced Option Maniulation' scheme and set the `shell` option on `spawn(...)`.
#### Scenario
- PHP is located at `C:\Users\mainuser\Applications\PHP\7.0.17-NTS-VC14\php.exe`.
- The batch file is located at `C:\Users\mainuser\MyProject\strap\php.bat`.
- I have set `%PATH%` manually to `C:\Users\mainuser\MyProject\strap\;%PATH%`.
#### Contents of php.bat
```batch
@echo off
REM We specify the whole path to PHP since the working directory is that of gulp...
REM unless we also changed that in our gulp callback.
C:\Users\mainuser\Applications\PHP\7.0.17-NTS-VC14\php.exe %*
```
#### Contents of our gulp task
```js
gulp.task('connect', function _gulp_connect_task() {
connect.server({
configCallback: function _configCallback(type, collection) {
if (type === connect.OPTIONS_SPAWN_OBJ) {
// Windows Batch files are NOT executable on their own. This will start a shell
// session then execute.
collection.shell = true;
return collection;
}
}
}, function _connected_callback() {
console.log("PHP Development Server Connected.");
});
});
gulp.task('default', ['connect']);
````
## Options
### port
Type: `number`
Default: `8000`
The port on which you want to access the webserver. Task will fail if the port is already in use.
### hostname
Type: `string`
Default: `'127.0.0.1'` *(usually same as `localhost`)*
The hostname the webserver will use.
Use `0.0.0.0` if you want it to be accessible from the outside.
### base
Type: `string`
Default: `'.'`
From which folder the webserver will be served. Defaults to the directory of the gulpfile.
### open
Type: `boolean`
Default: `false`
Open the server in the browser when the task is triggered.
### router
Type: `string`
Optionally specify the path to a [router script](http://php.net/manual/en/features.commandline.webserver.php#example-380) that is run at the start of each HTTP request. If this script returns `false`, then the requested resource is returned as-is. Otherwise the script's output is returned to the browser.
Example router script:
```php
<?php
// router.php
if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"])) {
return false; // serve the requested resource as-is
} else {
echo "<p>Thanks for using gulp-connect-php :)</p>";
}
?>
```
### bin
Type: `string`
Default: `'php'`
Path to the PHP binary. Useful if you have multiple versions of PHP installed.
### ini
Type: `string`
Default: Built-in `php.ini`
Path to a custom [`php.ini`](http://php.net/manual/en/ini.php) config file.
### stdio
Type: `string`
Default: `'inherit'`
Node's [stdio parameter](https://nodejs.org/api/child_process.html#child_process_options_stdio), set it to `'ignore'` to suppress all the logging into console of the php server process.
### configCallback
Type: `function (type, collection) : collection`
Prototype:
- `type` - String, either `OPTIONS_SPAWN_OBJ` or `OPTIONS_PHP_CLI_ARR`.
- `collection` - Array or Object, the initial version of the collection specified by `type`.
Return: Optionally modified version of `collection`.
Default: `'null'` (Which is replaced with a no-op call that returns an unmodified version of the `collection` parameter)
Allows the caller to modify the `spawn` [options](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) object and or the [PHP command line arguments](http://php.net/manual/en/features.commandline.options.php) (array) before the [PHP development server](http://php.net/manual/en/features.commandline.webserver.php) is invoked.
### debug
Type: `boolean`
Default: `'false'`
Enables debugging of the spawn call and its parameters.
## Building
This package comes with a NPM run-script command called `prepack`. This is intended to be run before the packaging and pushing to NPM, however it is also what builds the Node 4.X compatibility script `index-compat.js`. Without it the default `package.json` will not execute properly.
## License
MIT © [Micah Blu](http://micahblu.net)
================================================
FILE: convert.sh
================================================
#!/usr/bin/env bash
# set -x # verbose debugging
IN_FILE='index.js'
OUT_FILE='index-compat.js'
BABEL_PATH='./node_modules/babel-cli/bin/babel.js'
# Get script location, resolve if a link.
export SCRIPT_ROOT_ENV_SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SCRIPT_ROOT_ENV_SOURCE" ]; do
export SCRIPT_ROOT_DIR="$( cd -P "$( dirname "$SCRIPT_ROOT_ENV_SOURCE" )" && pwd )"
export SCRIPT_ROOT_ENV_SOURCE="$(readlink "$SCRIPT_ROOT_ENV_SOURCE")"
[[ ${SCRIPT_ROOT_ENV_SOURCE} != /* ]] && SCRIPT_ROOT_ENV_SOURCE="$SCRIPT_ROOT_DIR/$SCRIPT_ROOT_ENV_SOURCE"
done
export SCRIPT_ROOT_DIR="$( cd -P "$( dirname "$SCRIPT_ROOT_ENV_SOURCE" )" && pwd )"
pushd "$SCRIPT_ROOT_DIR" || { echo 'Could not enter primary directory.' ; exit 1; }
if [ ! -f "$BABEL_PATH" ]; then
npm i || { echo 'NPM Installation Failed.' ; exit 1; }
fi
echo "/* The following JavaScript file was preprocessed from $IN_FILE via Babel for support on older Node installations. */" > "$OUT_FILE.tmp"
"$BABEL_PATH" "$IN_FILE" --presets es2017,es2016,es2015 | sed '1d' >> "$OUT_FILE.tmp" || { echo 'Babel Processing Failed.' ; rm "$OUT_FILE.tmp"; exit 1; }
mv "$OUT_FILE.tmp" "$OUT_FILE"
popd || { echo 'Could not return from primary directory.' ; exit 1; }
================================================
FILE: examples/browser-sync/gulpfile.js
================================================
/* jshint esversion: 6, node: true */
'use strict';
const gulp = require('gulp'),
connect = require('../../index.js'),
browserSync = require('browser-sync');
gulp.task('connect-sync', function () {
connect.server({}, function () {
browserSync({
proxy: 'localhost:8000'
});
});
gulp.watch('**/*.php').on('change', function () {
browserSync.reload();
});
});
================================================
FILE: examples/browser-sync/index.php
================================================
<!DOCTYPE html>
<html>
<head>
<title>Browser Sync Example</title>
</head>
<body>
<?php echo "hello PHP world! :)"; ?>
</body>
</html>
================================================
FILE: examples/browser-sync/package.json
================================================
{
"name": "browser-sync-test",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^1.9.1",
"gulp": "^3.8.10"
}
}
================================================
FILE: examples/browser-sync-02/gulpfile.js
================================================
/* jshint esversion: 6, node: true */
'use strict';
const gulp = require('gulp'),
connect = require('../../index.js'),
browserSync = require('browser-sync');
//task that fires up php server at port 8001
gulp.task('connect', function (callback) {
connect.server({
port: 8001
}, callback);
});
//task that fires up browserSync proxy after connect server has started
gulp.task('browser-sync', ['connect'], function () {
browserSync({
proxy: '127.0.0.1:8001',
port: 8910
});
});
//default task that runs task browser-sync ones and then watches php files to change. If they change browserSync is reloaded
gulp.task('default', ['browser-sync'], function () {
gulp.watch(['**/*.php'], browserSync.reload);
});
================================================
FILE: examples/browser-sync-02/index.php
================================================
<!DOCTYPE html>
<html>
<head>
<title>Browser Sync Example 02</title>
</head>
<body>
<p><?php echo "hello PHP world :)"; ?></p>
<a href="link.php">Link to next page</a>
</body>
</html>
================================================
FILE: examples/browser-sync-02/link.php
================================================
<!DOCTYPE html>
<html>
<head>
<title>Browser Sync Example 02</title>
</head>
<body>
<p><?php echo "Hopefuly we are still at browserSync proxy port 8910:))"; ?></p>
<a href="index.php">Link to previous page</a>
</body>
</html>
================================================
FILE: examples/browser-sync-02/package.json
================================================
{
"name": "browser-sync-test",
"version": "1.0.1",
"description": "",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.0.0-rc9",
"gulp": "^3.8.10"
}
}
================================================
FILE: examples/simple/gulpfile.js
================================================
/* jshint esversion: 6, node: true */
'use strict';
const gulp = require('gulp'),
connect = require('../../index.js');
gulp.task('connect', function () {
connect.server({}, function () {
// connected
});
});
gulp.task('default', ['connect']);
================================================
FILE: examples/simple/index.php
================================================
<?php echo "hello world :)"; ?>
================================================
FILE: examples/simple-with-argument-manipulation/gulpfile.js
================================================
/* jshint esversion: 6, node: true */
'use strict';
const gulp = require('gulp'),
connect = require('../../index.js');
gulp.task('connect', function _gulp_connect_task() {
connect.server({
configCallback: function _configCallback(type, collection) {
// If you wish to leave one of the argument types alone, simply return the passed in collection.
if (type === connect.OPTIONS_SPAWN_OBJ) { // As the constant suggests, collection is an Object.
// Lets add a custom env var. Good for injecting AWS_RDS config variables.
collection.env = Object.assign({
MY_CUSTOM_ENV_VAR: "env_var_value"
}, process.env);
return collection;
} else if (type === connect.OPTIONS_PHP_CLI_ARR) { // As the constant suggests, collection is an Array.
let newArgs = [
'-e', // Generate extended information for debugger/profiler.
'-d', 'memory_limit=2G' // Define INI entry, Up memory limit to 2G.
];
// Ensure our argument switches appear before the rest.
return newArgs.concat(collection);
}
}
}, function _connected_callback() {
console.log("PHP Development Server Connected.");
});
});
gulp.task('default', ['connect']);
================================================
FILE: examples/simple-with-argument-manipulation/index.php
================================================
<?php
phpinfo();
?>
================================================
FILE: formatting.idea.xml
================================================
<?xml version="1.0" encoding="utf-8" ?>
<!-- This is an IDEA/JetBrains Code Scheme File for use with PhpStorm, WebStorm and IntelliJ -->
<code_scheme name="gulp-connect-php">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="FORMATTER_TAGS_ENABLED" value="true" />
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
<PHPCodeStyleSettings>
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
<option name="CONCAT_SPACES" value="false" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
<option name="VARIABLE_NAMING_STYLE" value="CAMEL_CASE" />
</PHPCodeStyleSettings>
<codeStyleSettings language="Blade">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="CSS">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Gherkin">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Haml">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true" />
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="LESS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PHP">
<option name="CLASS_BRACE_STYLE" value="1" />
<option name="METHOD_BRACE_STYLE" value="1" />
</codeStyleSettings>
<codeStyleSettings language="SASS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="SCSS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Twig">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
================================================
FILE: index-compat.js
================================================
/* The following JavaScript file was preprocessed from index.js via Babel for support on older Node installations. */
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
(function _gulp_connect_php_module_scoping(OPTIONS_SPAWN_OBJ, OPTIONS_PHP_CLI_ARR) {
var childProcess = require('child_process');
var spawn = childProcess.spawn;
var exec = childProcess.exec;
var http = require('http');
var open = require('opn');
var binVersionCheck = require('bin-version-check');
var fs = require('fs');
//let counter = 0;
function EnumSet() {
var _this = this;
[].concat(Array.prototype.slice.call(arguments)).forEach(function (x) {
_this[x] = Symbol(x);
});
}
var PhpDevelopmentServerConnection = function _PhpDevelopmentServerConnection_private_scope() {
var Status = new EnumSet('NEW', 'STARTING', 'STARTED', 'FINISHED');
/**
* Private: Check wherther the server is running.
* @param hostname
* @param port
* @param cb
*/
function checkServer(hostname, port, cb) {
var self = this;
//console.log(`[${this.counter}] checkServer`);
if (self.status !== Status.STARTING) return;
setTimeout(function _checkServer_fire() {
http.request({
method: 'HEAD',
hostname: hostname,
port: port
}, function _checkServer_httpCallback(res) {
var statusCodeType = Number(res.statusCode.toString()[0]);
if ([2, 3, 4].indexOf(statusCodeType) !== -1) {
return cb(true);
} else if (statusCodeType === 5) {
console.log('Server docroot returned 500-level response. Please check ' + 'your configuration for possible errors.');
return cb(true);
}
checkServer.call(self, hostname, port, cb);
}).on('error', function _checkServer_httpError(err) {
// back off after 1s
if (++self.checkServerTries > 20) {
console.log('PHP server not started. Retrying...');
return cb(false);
}
checkServer.call(self, hostname, port, cb);
}).end();
}, 15);
}
/**
* PHP Development Server Connection Instance
*
* {@link http://php.net/manual/en/features.commandline.webserver.php}
*/
var PhpDevelopmentServerConnection = function () {
/**
* Create a new Instance
* @param opts Default Options. Will be merged with our own internal set of default options. Can be overwridden in the connect ('server') call.
* @returns {PhpDevelopmentServerConnection}
*/
function PhpDevelopmentServerConnection(opts) {
_classCallCheck(this, PhpDevelopmentServerConnection);
//this.counter = ++counter;
//console.log(`[${this.counter}] constructor`);
this.status = Status.NEW;
this.checkServerTries = 0;
this.workingPort = 8000;
this.defaults = Object.assign({
port: 8000,
hostname: '127.0.0.1',
base: '.',
open: false,
bin: 'php',
root: '/',
stdio: 'inherit',
configCallback: null,
debug: false
}, opts || {});
return this; // `new` bug
}
/**
* 'Close'/Shutdown the PHP Development Server
* @param cb Optional single parameter Callback. Parameter is the return (if any) of the node `ChildProcess.kill(...)` call or nothing if not started.
*/
_createClass(PhpDevelopmentServerConnection, [{
key: 'closeServer',
value: function closeServer(cb) {
cb = cb || function _closeServerCb_noop() {};
//console.log(`[${this.counter}] closeServer`);
var self = this;
if (this.loading) {
setTimeout(function () {
return self.closeServer(cb);
}, 5);
return;
}
if (this.childProcess) {
cb(this.childProcess.kill('SIGKILL'));
this.status = Status.FINISHED;
return;
}
cb();
}
/**
* Get the port the server is running on.
* @returns {number|*} Port number.
*/
}, {
key: 'server',
/**
* Start the Server
* @param options Optional Server Options to overwrite the defaults in the CTor.
* @param cb Optional Callback for Completion. May pass in an error when there is a fault.
*/
value: function server(options, cb) {
//console.log(`[${this.counter}] server`);
cb = cb || function _serverCB_noop() {};
var self = this;
if (this.status !== Status.NEW && this.status !== Status.FINISHED) {
return cb(new Error('You may not start a server that is starting or started.'));
}
options = Object.assign({}, this.defaults, options);
this.workingPort = options.port;
var host = options.hostname + ':' + options.port;
var args = ['-S', host, '-t', options.base];
if (options.ini) {
args.push('-c', options.ini);
}
if (options.router) {
args.push(require('path').resolve(options.router));
}
if (options.debug) {
spawn = function _debugSpawn(outerSpawn) {
return function debugSpawnWrapper(file, args, options) {
console.log('Invoking Spawn with:');
console.log(file);
console.log(args);
console.log(options);
return outerSpawn(file, args, options);
};
}(spawn);
}
if (options.configCallback === null || options.configCallback === undefined) {
options.configCallback = function noOpConfigCallback(type, collection) {
return collection;
};
}
spawn = function _configCallbackSpawn(outerSpawn) {
return function configCallbackSpawnWrapper(file, spawnArgs, spawnOptions) {
return outerSpawn(file, options.configCallback(OPTIONS_PHP_CLI_ARR, spawnArgs) || spawnArgs, options.configCallback(OPTIONS_SPAWN_OBJ, spawnOptions) || spawnOptions);
};
}(spawn);
binVersionCheck('"' + options.bin + '"', '>=5.4', function _binVerCheck(err) {
if (err) {
cb(err);
return;
}
var checkPath = function _checkPath() {
var exists = fs.existsSync(options.base);
if (exists === true) {
self.status = Status.STARTING;
self.childProcess = spawn(options.bin, args, {
cwd: '.',
stdio: options.stdio
});
} else {
setTimeout(checkPath, 100);
}
};
checkPath();
// check when the server is ready. tried doing it by listening
// to the child process `data` event, but it's not triggered...
checkServer.call(self, options.hostname, options.port, function _server_checkServer() {
self.status = Status.STARTED;
if (options.open) {
open('http://' + host + options.root);
}
cb();
}.bind(this));
}.bind(this));
}
}, {
key: 'port',
get: function get() {
return this.workingPort;
}
}]);
return PhpDevelopmentServerConnection;
}();
return PhpDevelopmentServerConnection;
}();
module.exports = function _export_scoping() {
var returnStructure = PhpDevelopmentServerConnection;
var adopterBinder = function adopterBinder(adopter, inst, method) {
return adopter[method] = inst[method].bind(inst);
};
returnStructure.compat = function _naught_version_compatibility() {
// This is segregated beacuse in the future around v1.5 we will make it emit a warning.
// In v2.0 we will gut it completely.
var inst = new PhpDevelopmentServerConnection();
inst.OPTIONS_SPAWN_OBJ = OPTIONS_SPAWN_OBJ;
inst.OPTIONS_PHP_CLI_ARR = OPTIONS_PHP_CLI_ARR;
return inst;
}();
// You cannot actually bind a function to a method directly... so... lets manually bind to get a function that calls the right instance.
adopterBinder(returnStructure, returnStructure.compat, 'server');
adopterBinder(returnStructure, returnStructure.compat, 'closeServer');
returnStructure.OPTIONS_SPAWN_OBJ = OPTIONS_SPAWN_OBJ;
returnStructure.OPTIONS_PHP_CLI_ARR = OPTIONS_PHP_CLI_ARR;
return returnStructure;
}();
})('spawn', 'php_args');
================================================
FILE: index.js
================================================
/* jshint esversion: 6, node: true */
'use strict';
(function _gulp_connect_php_module_scoping(OPTIONS_SPAWN_OBJ, OPTIONS_PHP_CLI_ARR) {
const childProcess = require('child_process');
let spawn = childProcess.spawn;
const exec = childProcess.exec;
const http = require('http');
const open = require('opn');
const binVersionCheck = require('bin-version-check');
const fs = require('fs');
//let counter = 0;
function EnumSet() {
[...arguments].forEach((x) => { this[x] = Symbol(x) });
}
const PhpDevelopmentServerConnection = ((function _PhpDevelopmentServerConnection_private_scope() {
const Status = new EnumSet('NEW', 'STARTING', 'STARTED', 'FINISHED');
/**
* Private: Check wherther the server is running.
* @param hostname
* @param port
* @param cb
*/
function checkServer(hostname, port, cb) {
const self = this;
//console.log(`[${this.counter}] checkServer`);
if (self.status !== Status.STARTING) return;
setTimeout(function _checkServer_fire() {
http.request({
method: 'HEAD',
hostname: hostname,
port: port
}, function _checkServer_httpCallback(res) {
const statusCodeType = Number(res.statusCode.toString()[0]);
if ([2, 3, 4].indexOf(statusCodeType) !== -1) {
return cb(true);
} else if (statusCodeType === 5) {
console.log(
'Server docroot returned 500-level response. Please check ' +
'your configuration for possible errors.'
);
return cb(true);
}
checkServer.call(self, hostname, port, cb);
}).on('error', function _checkServer_httpError(err) {
// back off after 1s
if (++self.checkServerTries > 20) {
console.log('PHP server not started. Retrying...');
return cb(false);
}
checkServer.call(self, hostname, port, cb);
}).end();
}, 15);
}
/**
* PHP Development Server Connection Instance
*
* {@link http://php.net/manual/en/features.commandline.webserver.php}
*/
class PhpDevelopmentServerConnection {
/**
* Create a new Instance
* @param opts Default Options. Will be merged with our own internal set of default options. Can be overwridden in the connect ('server') call.
* @returns {PhpDevelopmentServerConnection}
*/
constructor(opts) {
//this.counter = ++counter;
//console.log(`[${this.counter}] constructor`);
this.status = Status.NEW;
this.checkServerTries = 0;
this.workingPort = 8000;
this.defaults = Object.assign({
port: 8000,
hostname: '127.0.0.1',
base: '.',
open: false,
bin: 'php',
root: '/',
stdio: 'inherit',
configCallback: null,
debug: false
}, opts || {});
return this; // `new` bug
}
/**
* 'Close'/Shutdown the PHP Development Server
* @param cb Optional single parameter Callback. Parameter is the return (if any) of the node `ChildProcess.kill(...)` call or nothing if not started.
*/
closeServer(cb) {
cb = cb || function _closeServerCb_noop() { };
//console.log(`[${this.counter}] closeServer`);
const self = this;
if (this.loading) {
setTimeout(() => self.closeServer(cb), 5);
return;
}
if (this.childProcess) {
cb(this.childProcess.kill('SIGKILL'));
this.status = Status.FINISHED;
return;
}
cb();
}
/**
* Get the port the server is running on.
* @returns {number|*} Port number.
*/
get port() { return this.workingPort; }
/**
* Start the Server
* @param options Optional Server Options to overwrite the defaults in the CTor.
* @param cb Optional Callback for Completion. May pass in an error when there is a fault.
*/
server(options, cb) {
//console.log(`[${this.counter}] server`);
cb = cb || function _serverCB_noop() { };
const self = this;
if (this.status !== Status.NEW && this.status !== Status.FINISHED) {
return cb(new Error('You may not start a server that is starting or started.'));
}
options = Object.assign({}, this.defaults, options);
this.workingPort = options.port;
const host = options.hostname + ':' + options.port;
const args = ['-S', host, '-t', options.base];
if (options.ini) {
args.push('-c', options.ini);
}
if (options.router) {
args.push(require('path').resolve(options.router));
}
if (options.debug) {
spawn = function _debugSpawn(outerSpawn) {
return function debugSpawnWrapper(file, args, options) {
console.log('Invoking Spawn with:');
console.log(file);
console.log(args);
console.log(options);
return outerSpawn(file, args, options);
}
}(spawn);
}
if (options.configCallback === null || options.configCallback === undefined) {
options.configCallback = function noOpConfigCallback(type, collection) {
return collection;
}
}
spawn = function _configCallbackSpawn(outerSpawn) {
return function configCallbackSpawnWrapper(file, spawnArgs, spawnOptions) {
return outerSpawn(file, options.configCallback(OPTIONS_PHP_CLI_ARR, spawnArgs) || spawnArgs, options.configCallback(OPTIONS_SPAWN_OBJ, spawnOptions) || spawnOptions);
}
}(spawn);
binVersionCheck(`"${options.bin}"`, '>=5.4', function _binVerCheck(err) {
if (err) {
cb(err);
return;
}
const checkPath = function _checkPath() {
const exists = fs.existsSync(options.base);
if (exists === true) {
self.status = Status.STARTING;
self.childProcess = spawn(options.bin, args, {
cwd: '.',
stdio: options.stdio
});
}
else {
setTimeout(checkPath, 100);
}
};
checkPath();
// check when the server is ready. tried doing it by listening
// to the child process `data` event, but it's not triggered...
checkServer.call(self, options.hostname, options.port, function _server_checkServer() {
self.status = Status.STARTED;
if (options.open) {
open('http://' + host + options.root);
}
cb();
}.bind(this));
}.bind(this));
};
}
return PhpDevelopmentServerConnection;
}))();
module.exports = (function _export_scoping() {
let returnStructure = PhpDevelopmentServerConnection;
const adopterBinder = (adopter, inst, method) => adopter[method] = inst[method].bind(inst);
returnStructure.compat = (function _naught_version_compatibility() {
// This is segregated beacuse in the future around v1.5 we will make it emit a warning.
// In v2.0 we will gut it completely.
const inst = new PhpDevelopmentServerConnection;
inst.OPTIONS_SPAWN_OBJ = OPTIONS_SPAWN_OBJ;
inst.OPTIONS_PHP_CLI_ARR = OPTIONS_PHP_CLI_ARR;
return inst;
})();
// You cannot actually bind a function to a method directly... so... lets manually bind to get a function that calls the right instance.
adopterBinder(returnStructure, returnStructure.compat, 'server');
adopterBinder(returnStructure, returnStructure.compat, 'closeServer');
returnStructure.OPTIONS_SPAWN_OBJ = OPTIONS_SPAWN_OBJ;
returnStructure.OPTIONS_PHP_CLI_ARR = OPTIONS_PHP_CLI_ARR;
return returnStructure;
})();
})('spawn', 'php_args');
================================================
FILE: package.json
================================================
{
"name": "gulp-connect-php",
"version": "1.0.3",
"description": "Starts a php server",
"main": "index-compat.js",
"scripts": {
"__anchor": "cd .",
"test-compat": "npm run __anchor; mocha ./test",
"test-normative": "npm run __anchor; GCP_ES6=1 mocha ./test",
"test": "npm run test-normative; npm run test-compat",
"prepack": "npm run __anchor; ./convert.sh"
},
"repository": {
"type": "git",
"url": "https://github.com/micahblu/gulp-connect-php"
},
"keywords": [
"gulp",
"php",
"server",
"connect"
],
"author": "micahblu",
"license": "MIT",
"bugs": {
"url": "https://github.com/micahblu/gulp-php/issues"
},
"dependencies": {
"bin-version-check": "^2.1.0",
"opn": "^1.0.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2016": "^6.24.1",
"babel-preset-es2017": "^6.24.1",
"mocha": "^3.2.0",
"supertest": "^3.0.0"
}
}
================================================
FILE: test/fixtures/config-cb-checker.php
================================================
ENVVAR=<?php echo getenv('TEST_ENV_VAR'); ?>,MEM_LIMIT=<?php echo ini_get('memory_limit'); ?>;
================================================
FILE: test/fixtures/hello.php
================================================
<?php echo "hello world"; ?>
================================================
FILE: test/fixtures/index.php
================================================
<?php echo "I am the root"; ?>
================================================
FILE: test/test.js
================================================
/* jshint esversion: 6, node: true */
'use strict';
require("mocha");
const testJSMain = process.env['GCP_ES6'] ? "../index.js" : "../index-compat.js";
console.log("Testing against primary => ", testJSMain);
const request = require("supertest"),
connect = require(testJSMain);
/*
- Anonymous Functions in the Test Suite should have internal names. This makes failure traces easier to read.
- For Simplicities sake, please avoid 'Arrow'-Functions (Lambda-like Constructs) and Opt for Anonymous Functions...
Like the first point, this makes failure traces simpler to read.
- Suites should be grouped by IIFE.
*/
const noop = function _noop() { };
const noopReturn = function _noopReturn(x) { return x; };
describe('gulp-connect-php', function _base_suite1() {
it('Should start a basic php server', function _test_basic(done) {
connect.server({port: 8001}, function _basic_serverCallback(error) {
if (error) throw error;
request('http://127.0.0.1:8001')
.get('/test/fixtures/hello.php')
.expect(/hello world/)
.expect(200)
.end(function _basic_endEvent(err, res) {
if (err) return done(err);
connect.closeServer(function _basic_closeServer() {
done();
});
});
});
});
it('Should start a set of basic php servers', function _test_multiples(done) {
let doneCounter = 0;
const tickDone = function _tickDone(x) {
++doneCounter === 2 ? done(x) : noopReturn(x)
};
const conn1 = new connect();
const conn2 = new connect();
conn1.server({port: 8002}, function _multiples1_serverCallback(error) {
if (error) throw error;
request('http://127.0.0.1:8002')
.get('/test/fixtures/hello.php')
.expect(/hello world/)
.expect(200)
.end(function _multiples1_endEvent(err, res) {
if (err) return done(err);
conn1.closeServer(function _multiples1_closeServer() {
tickDone();
});
});
});
conn2.server({port: 8003}, function _multiples2_serverCallback(error) {
if (error) throw error;
request('http://127.0.0.1:8003')
.get('/test/fixtures/hello.php')
.expect(/hello world/)
.expect(200)
.end(function _multiples2_endEvent(err, res) {
if (err) return done(err);
conn2.closeServer(function _multiples2_closeServer() {
tickDone();
});
});
});
});
it('Should start a basic php server, with a set environment variable and updated memory limits set via the configCallback option', function _test_configCallback(done) {
connect.server({
port: 8004,
configCallback: function _configCallback(type, collection) {
if (type === connect.OPTIONS_SPAWN_OBJ) {
collection.env = Object.assign({
TEST_ENV_VAR: "SET_OK"
}, process.env);
return collection;
} else if (type === connect.OPTIONS_PHP_CLI_ARR) {
let newArgs = [
'-d', 'memory_limit=2.1G'
];
return newArgs.concat(collection);
}
}
}, function _configCallback_serverCallback(error) {
if (error) throw error;
request('http://127.0.0.1:8004')
.get('/test/fixtures/config-cb-checker.php')
.expect(/ENVVAR=SET_OK,MEM_LIMIT=2\.1G;/)
.expect(200)
.end(function _configCallback_endEvent(err, res) {
if (err) return done(err);
connect.closeServer(function _configCallback_closeServer() {
done();
});
});
});
});
it('Should start a basic php server without a close callback', function _test_basicNoCloseCB(done) {
connect.server({port: 8005}, function _basicNoCloseCB_serverCallback(error) {
if (error) throw error;
request('http://127.0.0.1:8005')
.get('/test/fixtures/hello.php')
.expect(/hello world/)
.expect(200)
.end(function _basicNoCloseCB_endEvent(err, res) {
if (err) return done(err);
connect.closeServer();
setTimeout(done, 150);
});
});
});
it('Should start a basic php server, with a set environment variable and updated memory limits set via the configCallback option with null', function _test_configCallback(done) {
connect.server({
port: 8006,
configCallback: function _configCallback(type, collection) {
if (type === connect.OPTIONS_SPAWN_OBJ) {
collection.env = Object.assign({
TEST_ENV_VAR: "SET_OK"
}, process.env);
return collection;
} else if (type === connect.OPTIONS_PHP_CLI_ARR) {
return null;
}
}
}, function _configCallback_serverCallback(error) {
if (error) throw error;
request('http://127.0.0.1:8006')
.get('/test/fixtures/config-cb-checker.php')
.expect(/ENVVAR=SET_OK,MEM_LIMIT=2\.1G;/)
.expect(200)
.end(function _configCallback_endEvent(err, res) {
if (err) return done(err);
connect.closeServer(function _configCallback_closeServer() {
done();
});
});
});
});
it('Should start a basic php server, with a set environment variable and updated memory limits set via the configCallback option with no return', function _test_configCallback(done) {
connect.server({
port: 8007,
configCallback: function _configCallback(type, collection) {
if (type === connect.OPTIONS_SPAWN_OBJ) {
collection.env = Object.assign({
TEST_ENV_VAR: "SET_OK"
}, process.env);
return collection;
}
}
}, function _configCallback_serverCallback(error) {
if (error) throw error;
request('http://127.0.0.1:8007')
.get('/test/fixtures/config-cb-checker.php')
.expect(/ENVVAR=SET_OK,MEM_LIMIT=2\.1G;/)
.expect(200)
.end(function _configCallback_endEvent(err, res) {
if (err) return done(err);
connect.closeServer(function _configCallback_closeServer() {
done();
});
});
});
});
});
gitextract_mx95pi9m/
├── .babelrc
├── .editorconfig
├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── convert.sh
├── examples/
│ ├── browser-sync/
│ │ ├── gulpfile.js
│ │ ├── index.php
│ │ └── package.json
│ ├── browser-sync-02/
│ │ ├── gulpfile.js
│ │ ├── index.php
│ │ ├── link.php
│ │ └── package.json
│ ├── simple/
│ │ ├── gulpfile.js
│ │ └── index.php
│ └── simple-with-argument-manipulation/
│ ├── gulpfile.js
│ └── index.php
├── formatting.idea.xml
├── index-compat.js
├── index.js
├── package.json
└── test/
├── fixtures/
│ ├── config-cb-checker.php
│ ├── hello.php
│ └── index.php
└── test.js
SYMBOL INDEX (12 symbols across 2 files)
FILE: index-compat.js
function defineProperties (line 4) | function defineProperties(target, props) { for (var i = 0; i < props.len...
function _classCallCheck (line 6) | function _classCallCheck(instance, Constructor) { if (!(instance instanc...
function EnumSet (line 19) | function EnumSet() {
function checkServer (line 36) | function checkServer(hostname, port, cb) {
function PhpDevelopmentServerConnection (line 81) | function PhpDevelopmentServerConnection(opts) {
FILE: index.js
function EnumSet (line 15) | function EnumSet() {
function checkServer (line 28) | function checkServer(hostname, port, cb) {
class PhpDevelopmentServerConnection (line 69) | class PhpDevelopmentServerConnection {
method constructor (line 75) | constructor(opts) {
method closeServer (line 104) | closeServer(cb) {
method port (line 126) | get port() { return this.workingPort; }
method server (line 133) | server(options, cb) {
Condensed preview — 26 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (46K chars).
[
{
"path": ".babelrc",
"chars": 63,
"preview": "{\n \"presets\": [\n \"es2017\",\n \"es2016\",\n \"es2015\"\n ]\n}"
},
{
"path": ".editorconfig",
"chars": 188,
"preview": "root = true\n\n[*]\nindent_style = space\nindent_size = 2\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newli"
},
{
"path": ".gitignore",
"chars": 26,
"preview": "node_modules/\n.idea\n*.tgz\n"
},
{
"path": ".npmignore",
"chars": 76,
"preview": "node_modules/\n.idea\n.gitignore\n*.sh\n*.xml\n.babelrc\n.editorconfig\n*.tgz\n*.txz"
},
{
"path": "LICENSE",
"chars": 1077,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2014 Micah Blu\n\nPermission is hereby granted, free of charge, to any person obtaini"
},
{
"path": "README.md",
"chars": 7279,
"preview": "# gulp-connect-php\n\n***REQUIRES NODE 4 OR GREATER***\n\n> Start a [PHP-server](http://php.net/manual/en/features.commandli"
},
{
"path": "convert.sh",
"chars": 1223,
"preview": "#!/usr/bin/env bash\n\n# set -x # verbose debugging\n\nIN_FILE='index.js'\nOUT_FILE='index-compat.js'\nBABEL_PATH='./node_modu"
},
{
"path": "examples/browser-sync/gulpfile.js",
"chars": 390,
"preview": "/* jshint esversion: 6, node: true */\n'use strict';\n\nconst gulp = require('gulp'),\n connect = require('../../index.js')"
},
{
"path": "examples/browser-sync/index.php",
"chars": 135,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n\t<title>Browser Sync Example</title>\n</head>\n<body>\n\t<?php echo \"hello PHP world! :)\"; ?>\n"
},
{
"path": "examples/browser-sync/package.json",
"chars": 296,
"preview": "{\n \"name\": \"browser-sync-test\",\n \"version\": \"1.0.0\",\n \"description\": \"\",\n \"main\": \"gulpfile.js\",\n \"scripts\": {\n "
},
{
"path": "examples/browser-sync-02/gulpfile.js",
"chars": 735,
"preview": "/* jshint esversion: 6, node: true */\n'use strict';\n\nconst gulp = require('gulp'),\n connect = require('../../index.js')"
},
{
"path": "examples/browser-sync-02/index.php",
"chars": 189,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n\t<title>Browser Sync Example 02</title>\n</head>\n<body>\n\t<p><?php echo \"hello PHP world :)\""
},
{
"path": "examples/browser-sync-02/link.php",
"chars": 231,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n\t<title>Browser Sync Example 02</title>\n</head>\n<body>\n\t<p><?php echo \"Hopefuly we are sti"
},
{
"path": "examples/browser-sync-02/package.json",
"chars": 300,
"preview": "{\n \"name\": \"browser-sync-test\",\n \"version\": \"1.0.1\",\n \"description\": \"\",\n \"main\": \"gulpfile.js\",\n \"scripts\": {\n "
},
{
"path": "examples/simple/gulpfile.js",
"chars": 256,
"preview": "/* jshint esversion: 6, node: true */\n'use strict';\n\nconst gulp = require('gulp'),\n connect = require('../../index.js')"
},
{
"path": "examples/simple/index.php",
"chars": 31,
"preview": "<?php echo \"hello world :)\"; ?>"
},
{
"path": "examples/simple-with-argument-manipulation/gulpfile.js",
"chars": 1265,
"preview": "/* jshint esversion: 6, node: true */\n'use strict';\n\nconst gulp = require('gulp'),\n connect = require('../../index.js')"
},
{
"path": "examples/simple-with-argument-manipulation/index.php",
"chars": 20,
"preview": "<?php\nphpinfo();\n?>\n"
},
{
"path": "formatting.idea.xml",
"chars": 4435,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<!-- This is an IDEA/JetBrains Code Scheme File for use with PhpStorm, WebStorm "
},
{
"path": "index-compat.js",
"chars": 9434,
"preview": "/* The following JavaScript file was preprocessed from index.js via Babel for support on older Node installations. */\n'u"
},
{
"path": "index.js",
"chars": 8003,
"preview": "/* jshint esversion: 6, node: true */\n'use strict';\n\n(function _gulp_connect_php_module_scoping(OPTIONS_SPAWN_OBJ, OPTIO"
},
{
"path": "package.json",
"chars": 983,
"preview": "{\n \"name\": \"gulp-connect-php\",\n \"version\": \"1.0.3\",\n \"description\": \"Starts a php server\",\n \"main\": \"index-compat.js"
},
{
"path": "test/fixtures/config-cb-checker.php",
"chars": 94,
"preview": "ENVVAR=<?php echo getenv('TEST_ENV_VAR'); ?>,MEM_LIMIT=<?php echo ini_get('memory_limit'); ?>;"
},
{
"path": "test/fixtures/hello.php",
"chars": 29,
"preview": "<?php echo \"hello world\"; ?>\n"
},
{
"path": "test/fixtures/index.php",
"chars": 30,
"preview": "<?php echo \"I am the root\"; ?>"
},
{
"path": "test/test.js",
"chars": 6178,
"preview": "/* jshint esversion: 6, node: true */\n'use strict';\n\nrequire(\"mocha\");\n\nconst testJSMain = process.env['GCP_ES6'] ? \"../"
}
]
About this extraction
This page contains the full source code of the micahblu/gulp-connect-php GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 26 files (42.0 KB), approximately 11.1k tokens, and a symbol index with 12 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.