npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

px2agent

v2.0.7

Published

Pickles 2 と NodeJS スクリプトを仲介するAPIを提供します。

Downloads

17

Readme

px2agent

px2agent は、Pickles 2 と NodeJS スクリプトを仲介するAPIを提供します。

NPM

使い方 - Usage

var px2proj = require('px2agent').createProject('./.px_execute.php');


/**
 * Pickles 2 にクエリを投げて、結果を受け取る (汎用)
 */
px2proj.query('/?PX=phpinfo', {
	"output": "json",
	"userAgent": "Mozilla/5.0",
	"success": function(data){
		console.log(data);
	},
	"complete": function(data, code){
		console.log(data, code);
	}
});

/**
 * PXコマンドを実行する
 */
px2proj.px_command(
    'publish.run',
    '/index.html',
    {path_region: "/region/"},
    function(result){
    	console.log(result);
    }
);

/**
 * バージョン番号を取得する
 */
px2proj.get_version(function(value){
	console.log(value);
});


/**
 * configデータを取得する
 */
px2proj.get_config(function(value){
	console.log(value);
});

/**
 * サイトマップデータを取得する
 */
px2proj.get_sitemap(function(value){
	console.log(value);
});

/**
 * pathまたはidからページ情報を得る
 */
px2proj.get_page_info('/', function(value){
	console.log(value);
});

/**
 * 親ページのIDを取得する
 */
px2proj.get_parent('/sample_pages/', function(value){
	console.log(value);
});

/**
 * 子階層のページの一覧を取得する
 */
px2proj.get_children('/', function(value){
	console.log(value);
});
/**
 * 子階層のページの一覧を、filterを無効にして取得する
 */
px2proj.get_children('/', {filter: false}, function(value){
	console.log(value);
});

/**
 * 同じ階層のページの一覧を取得する
 */
px2proj.get_bros('/sample_pages/', function(value){
	console.log(value);
});

/**
 * 同じ階層のページの一覧を、filterを無効にして取得する
 */
px2proj.get_bros('/sample_pages/', {filter: false}, function(value){
	console.log(value);
});

/**
 * 同じ階層の次のページのIDを取得する
 */
px2proj.get_bros_next('/sample_pages/', function(value){
	console.log(value);
});

/**
 * 同じ階層の次のページのIDを、filterを無効にして取得する
 */
px2proj.get_bros_next('/sample_pages/', {filter: false}, function(value){
	console.log(value);
});

/**
 * 同じ階層の前のページのIDを取得する
 */
px2proj.get_bros_prev('/sample_pages/', function(value){
	console.log(value);
});

/**
 * 同じ階層の前のページのIDを、filterを無効にして取得する
 */
px2proj.get_bros_prev('/sample_pages/', {filter: false}, function(value){
	console.log(value);
});

/**
 * 次のページのIDを取得する
 */
px2proj.get_next('/sample_pages/', function(value){
	console.log(value);
});

/**
 * 次のページのIDを、filterを無効にして取得する
 */
px2proj.get_next('/sample_pages/', {filter: false}, function(value){
	console.log(value);
});

/**
 * 前のページのIDを取得する
 */
px2proj.get_prev('/sample_pages/', function(value){
	console.log(value);
});

/**
 * 前のページのIDを、filterを無効にして取得する
 */
px2proj.get_prev('/sample_pages/', {filter: false}, function(value){
	console.log(value);
});

/**
 * パンくず配列を取得する
 */
px2proj.get_breadcrumb_array('/sample_pages/', function(value){
	console.log(value);
});

/**
 * ダイナミックパス情報を得る
 */
px2proj.get_dynamic_path_info('/sample_pages/', function(value){
	console.log(value);
});

/**
 * ダイナミックパスに値をバインドする
 */
px2proj.bind_dynamic_path_param('/dynamicPath/{*}', {'':'abc.html'}, function(value){
	console.log(value);
});

/**
 * role を取得する
 */
px2proj.get_role('/sample_pages/actor1.html', function(role){
	console.log(role);
});

/**
 * Actor のページID一覧を取得する
 */
px2proj.get_actors('/sample_pages/role.html', function(actors){
	console.log(actors);
});

/**
 * get home directory path
 */
px2proj.get_realpath_homedir(function(value){
	console.log(value);
})

/**
 * コンテンツルートディレクトリのパス(=install path) を取得する
 */
px2proj.get_path_controot(function(value){
	console.log(value);
});

/**
 * DOCUMENT_ROOT のパスを取得する
 */
px2proj.get_realpath_docroot(function(value){
	console.log(value);
});

/**
 * get content path
 */
px2proj.get_path_content('/', function(value){
	console.log(value);
});

/**
 * ローカルリソースディレクトリのパスを得る
 */
px2proj.path_files('/', '/images/sample.png', function(value){
	console.log(value);
});

/**
 * ローカルリソースディレクトリのサーバー内部パスを得る
 */
px2proj.realpath_files('/', '/images/sample.png', function(value){
	console.log(value);
});

/**
 * ローカルリソースのキャッシュディレクトリのパスを得る
 */
px2proj.path_files_cache('/', '/images/sample.png', function(value){
	console.log(value);
});

/**
 * ローカルリソースのキャッシュディレクトリのサーバー内部パスを得る
 */
px2proj.realpath_files_cache('/', '/images/sample.png', function(value){
	console.log(value);
});

/**
 * コンテンツ別の非公開キャッシュディレクトリのサーバー内部パスを得る
 */
px2proj.realpath_files_private_cache('/', '/images/sample.png', function(value){
	console.log(value);
});

/**
 * domain を取得する
 */
px2proj.get_domain(function(value){
	console.log(value);
});

/**
 * directory_index(省略できるファイル名) の一覧を得る
 */
px2proj.get_directory_index(function(value){
	console.log(value);
});

/**
 * 最も優先されるインデックスファイル名を得る
 */
px2proj.get_directory_index_primary(function(value){
	console.log(value);
});

/**
 * ファイルの処理方法を調べる
 */
px2proj.get_path_proc_type('/sample_pages/', function(value){
	console.log(value);
});

/**
 * リンク先のパスを生成する
 */
px2proj.href('/sample_pages/', function(value){
	console.log(value);
});

/**
 * パスがダイナミックパスにマッチするか調べる
 */
px2proj.is_match_dynamic_path('/sample_pages/', function(value){
	console.log(value);
});

/**
 * ページが、パンくず内に存在しているか調べる
 */
px2proj.is_page_in_breadcrumb('/sample_pages/', '/', function(value){
	console.log(value);
});

/**
 * 除外ファイルか調べる
 */
px2proj.is_ignore_path('/sample_pages/', function(value){
	console.log(value);
});


/**
 * パブリッシュする
 */
px2proj.publish({
	"path_region": "/path/region/",
	"paths_region": [
		"/path/region1/",
		"/path/region2/"
	],
	"paths_ignore": [
		"/path/region/ignored/1/",
		"/path/region/ignored/2/"
	],
	"keep_cache": 1,
	"success": function(output){
		// console.log(output);
	},
	"complete":function(output){
		console.log(output);
	}
});

/**
 * キャッシュを削除する
 */
px2proj.clearcache({
	"success": function(output){
		// console.log(output);
	},
	"complete":function(output){
		console.log(output);
	}
});

PHPバイナリのパスを指定する場合 - Specifying path to PHP binary

var px2proj = require('px2agent').createProject(
  './px_execute.php',
  {
	'bin': '/path/to/php',
	'ini': '/path/to/php.ini',
	'extension_dir': '/path/to/ext/'
  }
);

開発者向け情報 - for developers

開発環境セットアップ - Setting up development environment

$ cd {$project_root}
$ composer install
$ npm install

テスト - Test

$ npm test

ドキュメント出力 - JSDoc

$ npm run documentation

更新履歴 - Change log

px2agent v2.0.7 (2021年1月16日)

  • pj.query() に、新しいオプション methodbodybodyFile を追加。

px2agent v2.0.6 (2019年8月12日)

  • pj.px_command() を追加。

px2agent v2.0.5 (2017年3月14日)

  • pickles2/[email protected] 対応
  • pj.publish()keep_cache オプションを追加。
  • pj.publish()paths_region オプションを追加。
  • pj.get_path_homedir()pj.get_realpath_homedir() に改名。(古いメソッド名の実装は残されているが非推奨)
  • pj.get_path_docroot()pj.get_realpath_docroot() に改名。(古いメソッド名の実装は残されているが非推奨)

px2agent v2.0.4 (2016年2月22日)

  • pickles2/[email protected] 対応
  • pj.publish()paths_ignore オプションを追加。

px2agent v2.0.3 (2015年11月9日)

  • pickles2/[email protected] 対応
  • アクター機能 pj.get_role(), pj.get_actors() を追加。

px2agent v2.0.2 (2015年9月15日)

  • PHPが異常終了した場合の例外をキャッチし、 false を返すようになった。

px2agent v2.0.1 (2015年9月10日)

  • PHPのパスを指定した場合の引数 -c-d に関する不具合を修正。
  • オプション extension_dir を追加。

px2agent v2.0.0 (2015年6月28日)

  • Initial Release.

ライセンス - License

MIT License

作者 - Author